In case you hadn’t already heard, Microsoft have released a comprehensive set of new web development features and tools designed to enhance rapid web application development in the form of Web Matrix.
Today’s article will focus on Internet Information Services (IIS) 7.5 Express, which is a “light” version of Microsoft’s heavyweight IIS web server. The express edition is aimed squarely at developers and provides a much richer set of functionality and support, which makes a great case from moving away from Visual Studio’s built-in web development server (aka Cassini).
Why would you use IIS 7.5 Express over Cassini?
- Supports multiple users
- Use the same web server your production code uses (IIS)
- You may run an IIS 7+ compatible webserver on Windows XP (if required)
- Avoid the need for local Administration rights (in most cases)
If you decide to use IIS Express 7.5, it integrates directly with Visual Studio 2010 (with Service Pack 1, which is required). I found it to be a little tricky to find at first, so here’s how I enabled it for a dummy web project. On your web project in Visual Studio’s Solution Explorer, right click to get the context menu. You’ll note a new menu item ‘Use IIS Express..’:
Once you follow the pop up boxes, you’ll have the project configured to use IIS Express
Clicking into the project’s web settings (right click-> Properties, select the Web tab) you’ll see that it uses the ‘Use Local IIS Web server’ option, and that there is a new check box called ‘Use IIS Express’ – it reuses the IIS settings, which threw me initially.
I’ll write up some more on using IIS Express 7.5 as I develop more with it..
For the full IIS Express experience, I highly recommend that you take a look at the IIS Express configuration files, which you can find conveniently in the following location (once you have configured it to be used, I would guess):
C:\Users\[Profile]\Documents\IISExpress\config
Here we will find three configuration files:
applicationhost.config – the bulk of the IIS configuration you’ll need
aspnet.config – specifies assemblies and versions
redirection.config – self explanatory, allows you to configure redirects and other goodness
Troubleshooting
If you migrate away from Cassini (Visual Studio Development Server – the ‘built-in’ web development server), there was one gotcha we found initially. When the project had previously been configured to use Cassini, we had specified a specific port (rather than dynamic ports):
When we configured to use IIS Express, you can see IIS settings are enabled, but when people ran the solution, it used the old Cassini port number instead! The solution was to set the Cassini option to Assign auto port, and then re-enable the IIS settings – it then used the correct port:
9 thoughts on “IIS 7.5 Express and Visual Studio 2010”
Will this also work with the Express edition of Visual Studio 2010?
I believe it is compatible with Express, but I haven’t tested it out.
Hello! Great post.
I have a problem though and I thought you could help. I created a new WebSite project. I then click the Use IIS Express option in the contextual menu. It changed the WebSite project from c:\…\WEbSiteName to http://Localhost:58376
I added a class library project and then checked in the solution.
My coworker then makes a Get Latest Version on the branch (TFS 2008). The solution loads but the web site is unavailbe. And he gets the following error :
http://localhost:58376 : error : Unable to open the Web site ‘http://localhost:58376’.
The Web server ‘http://localhost:58376’ could not be found.
I tried to reload project but it didn’t help. I had to roll back to the Cassini configuration and check in the solution in order to for him to be able to load the website project.
Any idea on how we can work collaboratively with TFS and IIS Express ? Can we uncheck a “Apply server settings to all users” on a website project like we can do with a “Web Application Project” ?
thank you!
Hi, does your co-worker have IIS Express 7.5 installed on his/her machine?
It does support collaborative deployment. If IIS Express is installed, there is a configuration file you can check to see if the port (58376) is configured. However, gut instinct is that Express is probably not installed.
Hi,
The ‘My Documents’ folder is on a network drive in my case and hence IIS express throws an error saying it cant read the ‘Redirection.config’ file. How can I change the path for my config files to point to a local folder.
Thanks
Binu
It might be easier to grant permissions for the IIS process to access your documents on the shared drive. If not, there might be a setting in the machine.config which can be used to change the default path.
does this IIS Express be bundled to web setup and Can use as a one package?
what I’m looking for a free web server to bundle with my web application
Hi there,
Yes, IIS Express is redistributable – check out the following for details:
http://blogs.iis.net/vaidyg/archive/2011/01/21/iis-express-bootstrapper-package.aspx