Multiple URL Binding with IIS Express

IIS Express is a lightweight, self-contained version of IIS and optimized for developers. IIS Express provides the power of IIS7.x  and makes it very easy to develop and test web applications. Visual Studio 2010 SP1  provides complete integration with IIS Express. In one of my previous post I discussed How you can Run “IIS Express” and “Cassini” simultaneously in Visual Studio 2010 SP1. In this post I am going to discuss about how you can bind multiple URL’s for a single Web Application with IIS Express.

First of all, you have to select “User IIS Express” option from the  Project Context menu to enable the IIS Express hosting for any new Web Project or Web Applications.


Once you select the  “Use IIS Express” option,  Visual Studio will assign one random free port for your application to host.


When you press F5 to run the project, Visual Studio can automatically launch IIS Express.  Like the ASP.NET Web Server, IIS Express will show up in your task-bar tray while it’s running.


You can right-click and  select the “Application”  to get the list of currently active URL’s for the current application.  To navigate, you have to click on the site URL.


Along with the hosting sites, IIS Express is the parent process of an application “IISExpressTray.Exe”. You can launch this application by just right click on IIS Express Icon on system tray icon and then select “Show All Applications” . This will open a  dialog where you can see all the running application on IIS Express.


As shown in the above image, currently the site which I developed is running on a single URL “http://localhost:2508” .

To enable SSL, first you have to go to “Project Properties” , then set “SSL Enabled = True” .


Now,  run the application, you can see there is different URL for SSL and non SSL for the single site.


If you are wondering where does these information getting stored, then you have to give a look inside your Web project file (.csprog) . Open the project file in any editor, you will find a section called <ProjectExtension>.  Project Extension has a child section called  Web Project Properties, where you can see all the setting and the related URL’s as shown below.


IIS Express use some different config files to host and run a web application.  You can find all the IIS Express related files under \users\<username>\My Documents \ IISExpress\Config . The main advantages here is, the aaplicationhost.config files are user specific.


Open the “applicationhost.config” file in any text editor, and search for the web application name. You will find a section as shown in below image


The section contains many information related with application pool, Virtual directory, etc. We will be focusing on the “bindings” area. As SSL is already enabled, you can see the binding for both http and https.

Now, if you want additionally bind some specific port, you have to specify port number  and other binding information’s.

Below is the settings where I used default port “80”  and my machine name instead of local host as URL.


Note : Port 80 is the default port and it’s restricted. You have to enable access of  the port  to IIS Express. You can use netsh command for that. For any other specific free port you don’t need this steps.

Save the config file and run the application from visual studio. Once it runs successfully, from system tray IIS Express, select “Show All Applications” .  As shown in below image, you will able to see your newly bind URL.


All the above URL’s are pointing to the same application.  You must have noticed, PID for all 3 sites are same. This PID is nothing but the Process ID of IIS Express, which is the container of these three site. You can examine the same, using process Explorer


This multiple binding is really helpful when you want to configure a specific port for SSL and  run the application over specific URL.

One interesting tips, When you press F5  to run this application from Visual Studio, you must  have seen http://localhost:2508 as startup URL.  Now, if you want any other URL to be startup ( let say you want https:// URL as start up ) , you have to follow few steps. First go to Project Properties > Select Web  Tab  and then look for “Use Local IIS Web Server” option to provide the SSL URL as project URL.


Save and Run the application, you will see https://localhost:44306 as your startup URL.


That’s all.

Hope this will help !

Cheers !


IIS Express , , , ,


  1. Pingback: DotNetShoutout

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: