Why use IIS Express over the Visual Studio Development Server (Cassini)?
I've seen Cassini run inconsistently on different machines, which resulted in the developers having to setup IIS on their local machines which also didn't end up working because they weren't all running the same OS.
Cassini doesn't support the <system.webServer /> node in your config file, which can also give inconsistent results when deployed.
Here are the reasons Scott Guthrie gives:
- It’s lightweight and easy to install (less than 10Mb download and a super quick install)
- It does not require an administrator account to run/debug applications from Visual Studio
- It enables a full web-server feature set – including SSL, URL Rewrite, Media Support, and all other IIS 7.x modules
- It supports and enables the same extensibility model and web.config file settings that IIS 7.x support
- It can be installed side-by-side with the full IIS web server as well as the ASP.NET Development Server (they do not conflict at all)
- It works on Windows XP and higher operating systems – giving you a full IIS 7.x developer feature-set on all OS platforms
- Be sure you have Microsoft Visual Studio 2010 Service Pack 1 installed.
- Download IIS Exress from Microsoft's Web Gallery.
Enabling IIS Express in your Web Application
Right click on your Web Application and select Use IIS Express...
When you run the Web Application you should now see the IIS Express tray icon.
By default, IIS Express will bind to the localhost host name. For most people this is not a big deal, but if you to make this accessible to other computers on the network, you'll have to add a second host name binding.
I run a few Virtual Machines on my box that have older browser version (ie6, etc.) and this is how I gain access with them.
To do this, right click on the tray icon and select Show All Applications and click the application you just created.
After clicking on the Config link (opens the applicationhost.config in Visual Studio) scroll down to the <sites /> section. You'll see a node that looks like this:
<site name="MvcApplication1" id="2"> <application path="/" applicationPool="Clr4IntegratedAppPool"> <virtualDirectory path="/" physicalPath="C:\DEV\MvcApplication1\MvcApplication1" /> </application> <bindings> <binding protocol="http" bindingInformation="*:5791:localhost" /> </bindings> </site>
Add a binding for your computer's name. In my case my computer is mobile5.
<site name="MvcApplication1" id="2"> <application path="/" applicationPool="Clr4IntegratedAppPool"> <virtualDirectory path="/" physicalPath="C:\DEV\MvcApplication1\MvcApplication1" /> </application> <bindings> <binding protocol="http" bindingInformation="*:5791:localhost" /> <binding protocol="http" bindingInformation="*:5791:mobile5" /> </bindings> </site>
Optional*: Open your project's properties and set your Start URL to http://mobile5:5791. Check the box "Override application root URL" and insert the same value http://mobile5:5791/
(if IIS Express is currently running you will have to stop it for the changes to take effect)
That should be it. You should now be running your Web Application under IIS Express. Other PCs or VMs should be able to view your projects via the additional binding.
* Skip the optional step if the project is used by multiple developers or opened on multiple machines.
** Additional bindings may require you to run Visual Studio as an Administrator or add entries into your host files.