Wednesday, June 10, 2009

Running Cassini (local) Web Server without having the Application Name in the url

One of the small issues of the Cassini server thats built in with Visual Studio IDE is that when you run it, it also has the Folder name of your application/project in the url. While this is not a major issue, it surely does some damage to the relative urls of images and/or other files which are relative. This would mean changing the relative paths for the development and production copies. I have done that in the past and know it is annoying if one forgets to change them, even though they can be stored in Application web.config file

One of the fixes that I found out was to configure the site using the external tools section of the IDE:


Clicking on the external tools takes you to the following window:



And thats what it is.

Follow this to have it done.

Click on "Add" to add a new Item to the project.
Title : This could be your project name
Command : This is the path for the Cassini Web server. Locate its exe and provide over here. This is what I have
(C:\Program Files\Common Files\microsoft shared\DevServer\9.0\WebDev.WebServer.EXE)

Arguments : Here you would assign a port number and your application folder as your arguments. The port number can be any number. The Application folder is where your project resides

/port:8085 /path:"C:\Users\Username\Documents\Visual Studio 2008\WebSites\SD30"


Once you are done. Click on Ok.

Now click on "Tools" from the IDE and you will see your Application Name in the Menu. Click on your Application Name to instantiate the Cassini Web Server for your Application. You will see the Web server activated in the task bar. Click on it to open your default page.

Thats all! Nice and Easy!

No comments: