Geeks With Blogs
Scott Kuhl Warning: I may have no idea what I am talking about!

Many companies either discourage the use of IIS on workstations or do not allow it.  Windows XP Home users are out of luck.  While Visual Studio 2005 has overcome this with a built in web server, many users will not be upgrading soon. 

This step by step approach shows how you can run Cassini, a secure, light-weight web server along with Visual Studio .NET 2003 to debug your ASP.NET applications locally.

  1. Download and install Cassini Web Server from http://www.asp.net/Projects/Cassini/Download/Default.aspx?tabindex=0&tabid=1
  2. Register the cassini.dll in the Global Assembly Cache.  You can do this by going to Control Panel -> Administrative Tools -> Microsoft .NET Framework 1.1 Configuration.  Right click on Assembly Cache, Select Add.., and Browse to the Cassini.dll you just installed.
  3. You need to find an existing solution with a Web project already in it.  You will not be able to just create a new web project as this requires Frontpage Server Extensions.
  4. Run Cassini.  Set the Application Directory to the same location as the web project.  Set the port to 80.  Set the Virtual Root to the same path found after localhost in the webproject.vbproj.webinfo file.  (You can find this by opening the file in Notepad.)
  5. Select the Start button in Cassini. You can click on the "Click To Browse” label to make sure the project is working, but it is not necessary.
  6. Open the solution file (.sln) in Notepad and change the UNC path (http://localhost...) to the web project to a file path (c:\xxxx\...).
  7. Run Visual Studio .NET and open the solution file.
  8. Stop Cassini.
  9. Set a start page (any will do).
  10. Right click on the web project file and select properties.
  11. Go to Configuration Properties -> Debugging.
  12. Change Start Action -> Start external program to C:\Cassini\CassiniWebServer.exe (or wherever you installed it.)
  13. Change Start Options -> Command line arguments to your web project location.  (Ex: C:\Projects\CWSTest\WebUI)
  14. Run the application in debug mode.  All "should" be good now. 

Now you can rename the project, files etc. 

Running Visual Studio in "Cassini Mode"

You will need to have Cassini running using the project settings whenever you open Visual Studio, and you will need to close it before running the application in debug mode.  Consider creating shortcuts to Cassini and Visual Studio with default startup parameters or create a batch file to ease your pain.

When running the application in debug mode only Cassini will start.  You need to click on the link in the Cassini window to open your browser.

Troubleshooting


Problem - Visual Studio .NET cannot create or open the application because no Web Server was detected at this URL: 'http://localhost'. Make sure the Web server is installed and running.

Solution - Cassini is not running.  Start it before starting Visual Studio every time.



Problem - Error while trying to run project: Unable to start debugging on the web server.  You do not have permissions to debug the server.

Solution - You can not start Cassini yourself, Visual Studio must do it. Set the Start Action settings to make sure Cassini is set to start (Step 12). 



Problem - Error while trying to run project: Unable to start debugging on the web server.

Solution - Check the Start Action settings to make sure Cassini is set to start (Step 12)



Problem - Cassini Managed Web Server failed to start listening on port xx.

Solution - Cassini is already running on the same port you have set to autostart the project on.  Did you forget to stop Cassini after opening Visual Studio?



Problem - 500 Internal Server Error when opening project or solution.

Solution - Make sure your Web.config file is valid.


Posted on Tuesday, September 13, 2005 8:35 AM Software | Back to top


Comments on this post: Debug ASP.NET Without IIS in Visual Studio.NET 2003

# re: Debug ASP.NET Without IIS in Visual Studio.NET 2003
Requesting Gravatar...
Problem - 500 Internal Server Error when opening project or solution.

Solution - Make sure your Web.config file is valid.

-- Could you be a little more specific here?

Left by BitHammer on Feb 15, 2006 10:41 AM

# re: Debug ASP.NET Without IIS in Visual Studio.NET 2003
Requesting Gravatar...
Your web.config file probably has bad xml markup. Maybe you forgot a closing tag? Try starting with a clean default web.config file to resolve the problem.
Left by Scott Kuhl on Feb 15, 2006 1:14 PM

# More Problems
Requesting Gravatar...
Visual Studio .NET cannot create or open the application. The likeliest problem is that required components are not installed on the local Web server. Run Visual Studio .NET setup and add the Web Development component.
Left by Steevn Wang on Feb 22, 2006 10:13 PM

# re: Debug ASP.NET Without IIS in Visual Studio.NET 2003
Requesting Gravatar...
Might the solution to Steevn's problem be to delete the web cache from his "My Documents" folder.
Left by Michael on Jun 06, 2006 6:44 AM

# re: Debug ASP.NET Without IIS in Visual Studio.NET 2003
Requesting Gravatar...
Where do you find the virtual root at?
Left by Corey on Jul 25, 2006 8:12 PM

# re: Debug ASP.NET Without IIS in Visual Studio.NET 2003
Requesting Gravatar...
The virtual root is set on the startup screen of Cassini. You set it based on the information in webproject.vbproj.webinfo. See step 5. I hope this answers your question.
Left by Scott Kuhl on Jul 26, 2006 5:28 AM

# re: Debug ASP.NET Without IIS in Visual Studio.NET 2003
Requesting Gravatar...
Hello,

The break point is not getting hit while running in debug mode, need help. Here is what I see -

"The breakpoint will not be currently hit. No symbols have been loaded for this document"

Left by Rishi on Jul 26, 2006 4:24 PM

# re: Debug ASP.NET Without IIS in Visual Studio.NET 2003
Requesting Gravatar...
Note sure. I don't remember running into that. And I have since moved on to 2.0. Sorry.
Left by Scott Kuhl on Jul 27, 2006 5:33 AM

# re: Debug ASP.NET Without IIS in Visual Studio.NET 2003
Requesting Gravatar...
If it helps, we wrote a commercial - grade server to replace cassini because of these headaches, you can use it instead of iis - www.neokernel.com
Left by damien on Jun 22, 2007 7:49 AM

Your comment:
 (will show your gravatar)


Copyright © Scott Kuhl | Powered by: GeeksWithBlogs.net