Thursday, May 5, 2011

Portable IIS : IIS Express 7.5

I have wanted a portable IIS since the first time I had to configure IIS to use :)
And that dream has come true with IIS 7.5 Express :

Unlike other express softwares IIS 7.5 is a complete version. Just more portable :)

I didn't know that I could get the server without webmatrix and that is the reason I am blogging about it (Download link for offline installation of IIS Express here same as mentioned above).

After you download it just install it. It is 32 bit version only. But that means that you can xcopy deploy your server + websites. Great for silverlight portable deployment scenario :)

Where does it get its websites?
By default IIS Express will load websites as folders from the current users "My documents folder", You can get this information by giving an invalid URL (Note the Physical Path):

Where does it gets its configuration to look for websites? 
This one was harder to answer. I needed to open process monitor to figure it out as shown:
And therein:

The command line options:
You can get a complete list of IIS Express from the command line as follows :
iisexpress.exe /h
Most important command line switches are options: 

Finally: Getting IIS Express to run portably: 
Two things need to be done here :

1.) Setting IISExpress to use config from the same folder as IISExpress and not user folder: 
I copied everything from "C:\Users\Basiee\Documents\IISExpress" to "%IIS_BIN%\User"

2.) Configuring the log files + websites to run from IIS_BIN
Just open applicationhost.config and configure your website as so:
Note I changed the website name. And modified the path for PhysicalPath / logfile and trace files

Now you can run IIS Express using the following command line: 
iisexpress /config:./USER/config/applicationhost.config

To learn everything in more detail visit :