IIS Express - Configure local website
Recently Microsoft announced release of IIS Express - a simple version of IIS - which you can configure to run websites locally. Microsoft also released a simple web development tool, WebMatrix, in which IIS Express is integrated to serve the purpose of development web server.
Benefits of IIS Express include:
- It has got same feature sets as of IIS production server
- Most tasks can be done with out the need for admin privileges
- It runs on windows XP and later versions
In part 1 of this article, I am exploring how we can manually configure IIS express to point to my local web pages in a directory. First we will see how we can make it work in plain http, and then next step we will create a WCF and will host it over SSL.
IISExpress is available for download here. Once you download install IIS Express, you will see all related files in the installation folder - normally, this will be under "C:\Program Files (x86)\IIS Express" folder if you are installing this on a windows 7 box with default selection. The executable file iisexpress.exe is the one which you need to run in order to activate the web server. This utility accepts many command line arguments to make proper settings according to the specifications. One of the parameters is a configuration file name where you specify the "applicationhost.config" file path.
Applicationhost.config is the root of IIS 7.0 and above configuration system, this includes definitions for all sites, applications, virtual directories and application pools, as well as global defaults for the web server settings. By default when you run iisexpress.exe without the config paramater, it will look for the applicationhost.config file under "%userprofile%\Documents\IISExpress\config" folder to load default configuration. So, if you want to create/add a new website under iisexpress, you will need to add this settings under a new or existing applicationhost.config file.
Below are the steps to configure local website in iisexpress.
Step 1. Create your webpages and organize it under a local drive. E.g. "C:\Test\MyWebsite" folder.
Step 2. Open applicationhost.config and look for <sites> node under <system.applicationHost>. (Ideally you can keep a copy of existing applicationhost.config and keep this separately if you want to play with it more).
Step 3. Add a site node under <sites>, where you specify details about your website.
<site name="WebSite1" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPa
th="
C:\Test\MyWebsite
" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":8080:localhost" />
</bindings>
</site>
Step 4. Open a command window and change directory to the folder where you installed iisexpress. Then run iisexpress.exe as follows
C:\Program Files (x86)\IIS Express>iisexpress.exe /config:"
C:\Test\MyWebsite
\Co
nfig\applicationhost.config
"
You will see the output in command window confirming the registration of URL and specified website as below.
Now browse the test page on the newly configured site in a browser as http://localhost:442/test.htm. Note the port number should be the same as you've given in your config file.
Note: You DO NOT NEED ADMIN PRIVILEGE to set up and run a website using iisexpress. So you can even package a small website to run completely with in a users box as a product CD version.
Reference:
- http://www.microsoft.com/downloads/en/details.aspx?FamilyID=abc59783-89de-4adc-b770-0a720bb21deb
- http://learn.iis.net/page.aspx/868/iis-express-overview/
- http://learn.iis.net/page.aspx/124/introduction-to-applicationhostconfig/
Note:
Imported from my site https://sites.google.com/site/dhtmlexperiments/blogs/iisexpress-configurelocalwebsite dated Mar 7, 2011
Comments
Post a Comment