Friday, April 18, 2008

Using Visual Studio .NET Built-in Web Server from Command Line

Ooooh, we love those undocumented utilities! Developers love the new built-in Web server; they'll like it even more at the command line.

Everyone should take time to browse the command line from time-to-time. You never know what you'll find lurking about in the recesses of all those folders on your system. The other day, I was exploring the .NET Framework 2.0 folder, \WINDOWS\Microsoft.NET\Framework\v2.0.50727. I found all of the utilities I expected — and one that I didn't.

It was a new application, named WebDev.WebServer.EXE. Other than the very odd filename, anyone who's worked with Visual Web Developer will instantly understand the implications of that application. This program lets you execute Web applications from within Visual Web Developer and Visual Studio 2005 using the built-in Web server.
I can't stress enough the importance of this particular application. The built-in Web server is one of the best ideas that Microsoft has had in a long time. You can create a local Web site using a folder containing Web files of any type, not just ASP.NET files. For example, I tested it with my personal Web site. It came right up in the browser using the built-in Web server.

While that's kind of cool, you should know the whole story before you decide about this particular .NET Framework 2.0 feature. No one but you can access the built-in Web server. First, it can use odd port numbers instead of the more common port 80. Also, Microsoft didn't design the server for outside access. Consequently, you can run your personal server without fear of prying eyes.