IIS Express is a lightweight, self-contained version of IIS optimized for developers. IIS Express provides the power of IIS7.x while making it easy to develop and test websites. Why we say that it has power of IIS7.x because it runs on code base of IIS 7.5. Visual Studio 2010 SP1 Beta allows you to build and test web applications using IIS Express instead of the built-in ASP.NET Development Web Server (Cassini). If you want to use IIS Express with VS 2010, you have to install IIS Express separately on top of Service Pack 1. To know more about details of use of IIS Express, please read the post http://bit.ly/i8BN1H . We can set IIS Express as default Web Server for Visual Studio or We can also change from Project Properties. Well, In this post I am going to talk about how we run the both IIS and Cassini simultaneously for multiple projects in a single solutions.
For any existing web project or for a new Web Application we can converted to use IIS Express very simply by just right clicking on project and select “Use IIS Express”
This is the simplest method that you can do to set IIS Express to take care for your web application. Now, This selection actually made some changes in Project Properties.
Go to Project Properties > Web Tab, you will find, Project has a setting with “Use IIS Express” Checked.
Now if you don’t want to do it for individual set IIS Express for all web projects, you can go to Tools > Option > Web Project and Select the Check Box “Use IIS Express for new file based web sites and projects”. This will set all of web project properties to run with “IIS Express”
Well, it was all about setup of IIS Express, let’s assume you have the above setup for IIS Express, which will make sure all the web project runs on IIS Express. Now let’s say you want to run one of you project using ASP.NET Development Server.
So for that, first of all you have to go to that particular project Properties window and then manually
- Un-Checked the setting “Use IIS Express”
- Select “Use Visual Studio Development Server”
This will disabled the IIS Express option for the selected web sites ( here it is WebApps2).
Now, if you want to run both project. Well, you might be thinking how you can run multiple project at same time, yes you can do it in Visual Studio. You can setup multiple project as startup from solution settings. You can read one of my blog post on that How to setup multiple startup projects in Visual Studio ?
Now, just Press F5 to run the application, you will see both the WebApps1 and WebApps2 runs simultaneously. And your web apps 1 running on “IIS Express” and Web Apps 2 running on “ASP.NET Development Server” . Below is the snaps from System Tray Icon.
If you clicked on the each system tray icon you will get below individual details.
To take a more inner look, let me use one of my favorite tool, Process Explorer ,
In the above process explorer snaps you can see, the parent process is Visual Studio Process ( Devenv.exe) and IISExpress.exe and WebDev.WebServer40.exe are the child process. You can also see, both the process has instantiated IE Process ( iexplore.exe ) for each individual sites.
Just to summarizes, we all know the power of both Visual Studio ASP.NET Development server ( Cassini ) and newly introduced IIS Express. In this post I just talked about how we can run the side by side same time.