Tuesday, January 04, 2005 - Posts

Developing ASP.NET applications in VS2003 without IIS

April 25 thru April 26, 1998 the Cassini spacecraft flew by Venus. This is still one of the highlights from its journey through space. Venus is also the codename of Microsoft’s ASP.NET 2.0 project. Visual Studio.NET 2005 uses an embedded web server based on the Cassini light-weight web server to run “Venus” applications. The embedded web server is a great feature for a number of reasons. You can develop ASP.NET application with a restricted account without spending hours configuring Internet Information Server, group memberships, DACLs and other things. Further you don’t have to have your application setup as a virtual directory in IIS. In fact, you don’t have to have IIS installed at all!

Visual Studio .NET 2005 hasn’t got an official release date yet, but sometime around July is a qualified guess. However, you can ditch Internet Information Server today and run and debug your ASP.NET applications with Cassini from Visual Studio .NET 2003. All you have to do is some additional project configuration:

  1. Download and install Cassini. Cassini can be downloaded from http://www.asp.net/Projects/Cassini/Download/Default.aspx?tabindex=0&tabid=1
  2. Register the cassini.dll in the Global Assembly Cache (GAC). You can use the Microsoft .NET Framework 1.1 Configuration tool located in the Administrative Tools directory or the gacutil command to do this. The Cassini assembly has a strong name, so there is no need to sign it unless you’ve built your own customized version.
  3. Create a new Class Library project.
  4. Add a reference to the System.Web.dll assembly.
  5. Add a web form to the project. Class library projects haven’t got the same wizards as web projects, so you’ll have to improvise. I suggest you add a new HTML page, and rename this to Default.aspx.
  6. Right click the project and choose “Properties”.
  7. On the Configuration Properties > Build page, change the Output Path setting to “bin\”.
  8. On the Configuration Properties > Debugging page, change the Debug Mode setting to “Program”.
  9. Click the Apply button.
  10. On the Configuration Properties > Debugging page, enter the path to the CassiniWebServer.exe file in the Start Application setting.
  11. On the Configuration Properties > Debugging page, enter the path for the project and the port number you want Cassini to use in the Command Line Arguments field. For example: "C:\Documents and Settings\anders.noras\My Documents\My Projects\Examples\CassiniInVs2003"  8080
  12. Close the properties dialog and press the play button.
  13. When the Cassini Personal Web Server dialog appears, click the link and your ASP.NET application should start.

If your user account doesn’t have administrative privileges, an administrator must grant your account modify and write access to the Temporary ASP.NET Files folder. You’ll also need administrative privileges to register the cassini.dll in the GAC.

You’ll have to navigate through some asteroid fields when using Cassini instead of IIS, the most apparent are the missing ASP.NET wizards and not being able to drag user controls onto a web form. However, for an experienced developer, these obstacles are minor and I believe that the trade-off is justified by the comfort of being IIS idependant.