How to configure the Virtual Path of ASP.NET Development Server to be “Root”
Posted by: Rickie Lee http://rickie.cnblogs.com
As we know, Visual Studio 2005 & .Net Framework 2.0 provide the built-in test web server, named ASP.NET Development Server (located at C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\WebDev.WebServer.EXE). By default, VS 2005 IDE treat each ASP.NET web site project as a sub virtual dir under the root site when running them in test server. Like the following example:
http://localhost:portnumber/ApplicationName/
However, in fact we often want to run web site projects in the root site, in order to reference static resources, such as images and CSS files. Although we know that we can use “~” symbol to refer to the root of the virtual web application for dynamic resources, static resources still be in trouble.
You can take the following steps to overcome this issue and change ASP.NET web site project as the root site.
1. Run the following command in [Visual Studio 2005 Command Prompt] window:
webdev.webserver /port:8181 /path: "the physical path of your web project" /vpath:"/"
2. Configure ASP.NET web project’s property using VS 2005 IDE.
(1) Choose <Start Options> tab page under web project property page dialog.
(2) Select <Use custom server> radio button under Server section, and type the following content into Base URL text box:
Please note that the port number should be the same as the preceding setting.