Thursday, September 08, 2005

Development Web Server Included with VS.NET 2005

At last week's MSDN demonstration in Detroit, Bill Steele showed off how Visual Studio.NET 2005 will provide a web server for FileSystem-based web sites, which means that you can develop and test ASP.NET applications without the need for IIS! Very cool!

I started exploring to see if this could be invoked outside of VS.NET 2005, and indeed it can! My machine running VS.NET 2005 includes a program in the v2.0 Framework directory called WebDev.WebServer.exe. Another machine with an older version of the v2.0 Framework (but without VS.NET 2005) did not have this file, so I'm not sure if it will be included as part of the framework going forward, or if it's only included as part of Visual Studio.

An excerpt from a separate writeup that I'm working on:

Visual Studio.NET 2005 provides a small stand-alone web server that can be used by developers to test ASP.NET web applications without requiring IIS. Right-click on a FileSystem-based Web Site project, then choose "View in Browser" in the context menu, and the web server will launch and listen on a random port number.

To start this web server manually, use the following command entered on a single line (from START Run, or from a command prompt):

%windir%\Microsoft.NET\Framework\v2.0.50215\WebDev.WebServer /port:1337 /path:"c:\src\AspnetWebapp"

The /port parameter is used to set the port number that the server listens on. In this example, it is set to 1337, but if that port is already in use, then you can set it to anything other port that is open.

The /path parameter is used to tell the web server where the webroot directory is. This would be the equivilent to being c:\inetpub\wwwroot for IIS.

A third parameter (not shown) is /vpath, and is used to set the virtual directory that will be mapped to that physical path.