How to use IIS Express

2012-09-04


About how to use IIS Express is simple, and easy to search many helpful information. So I did not want to write a blog to record how to use IIS Express. However, there were not only one or two times, I and my team members still need to find out how to use sometimes since we forgot the process even it is so simple.

OK, let me start the simple steps:

(Note: the following steps only tested on Windows 7)

1: Download IIS Express and install it on your computer:

I downloaded IIS 7.5 (here is downloading link). I don’t know whether you could get any error message if you did not install .NET 4.0 framework first, if you really get a related error message, please followed the tip message to install or fix something first;

2: After installation, Go to "Documents" folder:

image

3: Choose "IISExpress" folder , and then "config" folder, open the file "applicationhost.config" using a text editor such as Notepad or Notepad++::

Update:  If you can not see an IISExpress folder in your Documents folder, please go to "c:\Program Files (x86)\IIS Express" (64-bit system) or "c:\Program Files\IIS Express"(32-bit system) to run IISExpress.exe once time, and then you can find a "IISExpress" folder was generated under your Documents folder.

image

4: Locate at the line of "<sites>", you can add a new site inside <sites> and </sites> tab:

Please check the following screen shot: The content in the blue box is a new website, the 4 boxes in red color are the content which you should change due to your own settings:

image

name="MyMVC3": Giva a name to your new site.

id="127" : you set a unique id number for your new website;

physicalPath: it is the folder which your web published files and content, for example, you got a generated web zip file, just unzip it to any folder what you want. for my case, I put them to "C:Users\Tony\Desktop\MyMVC3\ folder", like the following:

image

bindingInformation: this is for a port number, you can put a valid port number as long as it is not limited for Windows system.

The following is the text content:

<site name="MyMVC3" id="127" serverAutoStart="true">
    <application path="/">
        <virtualDirectory path="/" physicalPath="C:\Users\Tony\Desktop\MyMVC3\" />
     </application>
      <bindings>
         <binding protocol="http" bindingInformation=":3576:localhost" />
      </bindings>
</site>  

5: After above settings, go to DOS Command UI, and run the following 2 lines of commands:

cd C:\Program Files (x86)\IIS Express

iisexpress /site:MyMVC3

MyMVC3 is my site name which I set in config file above;_

Because My windows 7 is 64-bit system, so I used the folder Program Files (x86), if your Windows 7 is 32-bit system, just use "cd \Program Files\IIS Express";

Now you can see the following DOS command screen, you now see IIS Express has already register a URL for your website MyMVC3, my case is http://localhost:3576/

image

6: User your web browser to open the URL http://localhost:3576/, you will see your website now:

image

Actually, I just gave ONE example to use IIS Express, for more details, please visit Microsoft IIS Official site and check more IIS Express settings.