Thursday, December 20, 2007

Tips & Tricks: Start-Up Options and Instances of ASP.Net Development Server in a Multi-project Solution

If you have more than one project in your solution you can use following options of solution properties to set your start up actions...  You can get the below dialog by right clicking your solution and going to its properties:

image 

If you have more than one Web project (either Web Site, WAPs or both) in your solution and choose to start only one of it, you can do so by setting "Single startup project" above (or also via  Project context menu "Set as StartUp Project" in solution explorer)...  Although, even after doing so when you start debugging your application using ASP.Net Development Server you will see multiple instances of ASP.Net Development Servers in your system tray as shown below:

image

There is an important point to note here that a single instance of ASP.NET Development Server cannot handle more than one Web Application/Site...  Ideally if you need this kind of functionality you should be using IIS for your debugging instead of ASP.NET Development server...

There are instances when you might have many web applications or web sites in the same solution and you may be actually debugging only one of them...  In such scenario it might not be desirable to have multiple instances of ASP.NET Development Server running...  VS provides an explicit setting in the property grid of web application/site called Development Web Server - "Always Start When Debugging" which is set to True by default...  If you set this Property to be False only one web server instance will be created for the start up web project...

You might want note that in that same debug run, you will not be able to debug any other non-IIS based Web Application/Site in the solution who has this property set to "False"; but if you really want to debug just one application at a time you may not have to worry about it anyway...

4 comments:

Anonymous said...

If this was ever true, it isn't anymore, at least not for web sites (not web projects) in VS2008 SP1. Very frustrating because there is no way I can find to stop all those dang development server isntances from starting up.

Anyone find it?

Unknown said...

I just installed VS2008 and applied SP1. I converted the VS2003 solution to VS2008. The VS2003 solution contains 21 projects. After the conversion I followed instructions that Vishal provided here and I can debug without VS showing multiple ASP.Net Development server icons for each the projects in the solution.

Anonymous said...

I really wish this default were "false". I have never had a case where I want all 10 web projects in our solution to start at once ... and every time I have to do a new checkout I have to go turn all of these settings off. Sadly, VS2010 did not fix this ... we are still saddled with this unfortunate behavior.

ASP.Net Migration said...

Great information about .Net development.