Let’s say you have a following task: your small ASP.NET (MVC) website needs to be run on a computer that does not (necessarily) IIS have installed. How to make it possible?
You can do it using IIS Express. It is a small version of IIS server that Microsoft ships for free with at http://www.microsoft.com/download/en/details.aspx?id=1038. It is shipped with Visual Studio 2010 SP1 too (so there is a chance you already got it in C:\Program Files (x86)\IIS Express). They say it’s not xcopy deployable (meaning you cannot run it without installation) but it kinda is. You have to simply install it on one machine and take out what the files you need (or basically the whole folder) to copy and run it on other machine.
Here is a quick prescription:
1. take your web application and copy it to the folder “web”,
2. take the whole inside of the folder C:\Program Files (x86)\IIS Express and copy it to the folder “iis”,
3. create a cmd file to run the iis express with your app and place it on the same level as your “web” and “iis” folders, it should look like this:
It will start the IIS Express (from “iis” folder) set the web application path to web folder “web” (%CD% is current directory). IIS Express is started on the 8181 port (in fact it does not matter on what port it is started as long this port is free). After that we start the Internet Explorer and direct it to the website. On slower machine it can take some time to start the server (and as we use start command the batch will not wait and start the next command right away) so you can think of a small delay (using for example ping -n 1 220.127.116.11 >nul for 1 second delay).
Such package can be zipped and send to someone to run a local copy of your application. Of course it can be wrapped around another MSI package and automated to pick free port and add an icon to the desktop or start menu.
The only prerequisite for IIS Express to run is .NET Framework 4 and it will run on XP and up. It can run side to side with a “big” version of IIS.
By default IIS Repress hosts only the localhost websites. It is possible to configure it to server over the wire (see http://stackoverflow.com/questions/5235826/using-iis-express-to-host-a-website-temporarily). It should be possible to host a standalone SQL Server version too. But it is a topic for another blog post!