Enabling IIS Express support in VS 2010 Sp1
With the Sp1 release of Visual Studio 2010 now available for download, you now have the option to use IIS Express as the development server for your web projects instead of the built-in Visual Studio Development server (aka. Cassini). Here are some previous blog posts explaining the IIS Express integration features in VS 2010 Sp1 Beta, which are also available with this new release of Sp1:
VS 2010 SP1 and IIS Express should both be installed to enable IIS Express support
To enable using IIS Express as the development server for your web projects, you need to have both the Sp1 release of VS 2010 as well as the IIS Express web server installed. See the ‘Installing VS 2010 Sp1 and IIS Express’ section below for details on how to do this.
Sharing projects that use IIS Express in a team environment – Note that the RTM release of VS 2010 does not know about IIS Express, as the feature was added only in Sp1. This means that if you have a project using IIS Express in VS 2010 Sp1 and share that project with a teammate who is still running VS 2010 RTM, then VS 2010 RTM will make an attempt to open the project as if it were an IIS project and probably give you an error similar to “Could not find the server ‘http://localhost:20221’ on the local machine” (assuming that no site with that binding exists in IIS). If everyone on the team is using VS 2010 Sp1, then you will not run into this problem.
If you do have some folks on the team using VS 2010 RTM and others using VS 2010 Sp1, then for Web Application Projects, you can work around the above issue by unchecking the “Apply server settings to all users (store in project file)” checkbox in the Property Pages > Web tab of the WAP. This causes the server selection (Cassini or IIS Express) and related settings to get stored on a per-user basis in the .suo user file rather than in the project file, thus causing the server selection to not persist into source control. This will allow the VS 2010 RTM users on the team to still use Cassini while the VS 2010 Sp1 user can use IIS Express for the same project. For Website Projects, it is necessary that everyone on the team need to be using VS 2010 Sp1 to be able to share projects and use IIS Express.
Installing VS 2010 SP1 and IIS Express:
- When you install Sp1 from the download page, you should install the IIS Express server separately
The VS 2010 Sp1 installer, by itself, includes only the tooling in VS to support using IIS Express as the development server. So after installing Sp1, you will see that a new checkbox exists under Tools > Options > Projects and Solutions > Web Projects to use IIS Express for new websites and web projects, but this checkbox is disabled (see figure 1 below).
Figure 1 – IIS Express needs to be installed for Sp1 tooling to light-up
To enable the above checkbox and to “light-up” other IIS Express support features such as the right-click option to change from Cassini to IIS Express, you will need to download and install the IIS Express server.
- Alternatively, if you install Sp1 via Web Platform Installer, IIS Express is bundled along with the VS 2010 Sp1 installer
You can also install VS 2010 Sp1 via the Web Platform Installer (Web PI). To do this, you need to first download and install Web PI. Then open WebPI and choose ‘Visual Studio 2010 SP1’ (or ‘Visual Web Developer Express 2010 SP1’ if you are using VWD Express) and click Add, and then Install (see figure 2 below).
Installing VS 2010 Sp1 in this fashion allows you to quickly install not only the core VS 2010 Sp1 package but also various other goodies such as ASP.NET MVC 3, SQL CE 4 and the stand-alone IIS Express server (see figure 3 below).
Figure 2 – Installing Sp1 via Web Platform Installer
Figure 3 – Installing Sp1 via WebPI gets you various goodies such as IIS Express, MVC 3 and SQL CE 4
Verifying that IIS Express is installed
- You can verify that it is installed properly by looking at the list of installed programs, as shown in figure 4.
Figure 4 – IIS Express is installed
Once you install IIS Express, the checkbox in figure 1 will now become enabled and you can check it if you want to use IIS Express as the default server for new websites and web projects. Additionally, the right-click option to use IIS Express will also show up in the context menu for both websites and web application projects (see figure 5 below). If your project is already using IIS Express, the context menu will change to ‘Use Visual Studio Development Server …’ to allow you to change back to Cassini if you need to.
Figure 5 – Use IIS Express context menu