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):
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
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: