Views: 4654
Number of votes: 0
Average rating:

Running EPiServer CMS in IIS Express

Introducing IIS Express

This summer Microsoft released their WebMatrix platform. WebMatrix is intended as a getting started-kit for web development, containing SQL Server Express, Visual Web Developer Express, a number of example projects and snippets (and online access to more) and a web server: IIS Express.

IIS Express is built on the same core as IIS 7 but is designed to run in a stand-alone process in the current user’s context. This gives developers some new options:

  • Devs still stuck with Windows XP or Server 2003 can get an IIS 7 compatible web server running on their machines.
  • If you don’t want to run your sites in the local IIS when debugging from Visual Studio, you should be able to use IIS Express rather than the ASP.NET Development server and get the full IIS 7 feature set.

For more information on IIS Express, check out Scott Gu’s blog post

The Scenario

The reason I started exploring IIS express was that I wanted to run a dev/test site at home, on my home server. That machine is currently running Windows XP while my dev laptop is Windows 7. To avoid the hassle of double config sections I wanted to run IIS 7 on both machines. IIS Express fixes this.

Installing IIS Express

As mentioned, IIS Express is part of the WebMatrix bundle. So you have to download the WebMatrix installer, but you can then customize the install to include only the parts you need. IIS Express is part of the base set so at first I was trying to find it among the install options but I didn’t. It seems it’s always installed, but you don’t have to install Visual Web Developer etc. unless you want to.

Setting up a site in IIS Express

You can’t use EPiServer Deployment Center to install a site in IIS Express since it’s not run as a service. So there’s no (easy) way to install a new site on the machine running IIS Express.

When launching WebMatrix there is instead an option to create a site from a folder. So if you have installed the EPiServer site on another machine (in my case the dev laptop) you can just publish your solution to a folder and create a site from it in WebMatrix.

Running sites in IIS Express

WebMatrix is then the launch pad for your sites where you set their URL, port and start/stop the sites. It is however possible to launch IIS Express from a command prompt. It’s located in your Progam Files folder under Microsoft Web Matrix and is called iisexpress.exe.

Your site definitions will be stored in an xml file called applicationhost.config in a folder called IISExpress under the current user accounts Documents folder. This file will be used when launching iisexpress.exe and the first site defined (it seems) will be launched.

Using switches it is possible to set what site should be started and even which .config file should be used. So you can store the applicationhost.config in a central location away from the user settings folder if you like:

iisexpress /config:c:\myconfig\applicationhost.config /site:Website1

You can even start a site directly from the folder where it’s stored:

iisexpress /path:c:\myapp\ /port:80

Hosting a site using IIS Express

IIS isn’t intended for hosting. But since it can be started as a console app there’s at least a possibility to start it as a scheduled task when the computer starts up or to run it as a windows service using a generic host. But will it work? Out of curiosity I had to try and yes it will! With some limitations of course.

One limitation is that there is no way to set multiple host headers (at least not that I can find). The site is configured to run under a host/port combination, default to localhost/machine name and port 8080. Set it to use your external domain name and port 80 and it’s ready to go.

I did some basic testing using the free test on LoadImpact. There seems to be no connection limit, at least not up to the 50 connections that the free test uses. It seems to scale rather well in this connection count span, even with my rather weak hardware.

 Post a comment