Tuesday, July 20, 2010

ASP.NET and IIS

As part of an upcoming integration project at work it seems that I will need to learn another web application server platform, Microsoft's Internet Information Service (IIS). As part of my setup I need to make sure that IIS is installed and also it supports ASP.net.  Once those steps are complete I can proceed with the integration.  Here is an IIS tutorial for anybody with Windows XP Professional.


  • Install IIS
    • Go to Add/Remove Programs. Start Menu > Control Panel > Add or Remove Programs.
    • Click the Add/Remove Windows Components on the left navigation bar. 
    • Select the Internet Information Services (IIS) optoin and hit Next.

    • This will install IIS, just click complete when it is done.
  • Verify the IIS Install
    • By default a new directory c:\Inetpub\wwwroot will be created.
    • Create a new text file here with the name HelloWorld.html
    • Insert the following into the file and save it:
      <html> <body><h1>Hello World</h1></body></html>
    • Launch the Windows Run dialog either Start > Run... OR WindowsKey-R
    • Type in the command inetmgr and press enter.
    • Navigate to the Default Web Site node in the navigation tree to display the files on the right.

    • Right click on HelloWorld.html and select Browse. This should launch the page in your browser.
  • Configure ASP.NET
    • Go back to the c:\Inetpub\wwwroot directory.
    • Make a copy of HelloWorld.html and call it HelloWorld.aspx
    • Insert the following into the file after the Heading <%   response.write(Request.ServerVariables("SERVER_SOFTWARE")) %>
    • Go back to the inetmgr
    • Navigate to the Default Web Site node again.
    • In the menu choose Action > Properties
    • Go to the ASP.NET tab in the pop up and select a version in the ASP.NET version drop down.
    • Hit OK.
    • Back in the IIS Manager click on the Web Service Extensions node in the navigation tree.
    • Click on the ASP.NET web extension and then hit Allow.
    • Navigate back to the Default Web Site node in the navigation tree.
    • Right click on the HelloWorld.aspx file and choose Browse to launch it in your browser.
    • You should see the Hello World heading along with a print out of the current version of IIS.
The only problem I faced when doing this was getting the ASP.NET version set correctly.  I ended up going to the .NET SDK Download Site and getting the latest version, but in hindsight it may not have been necessary.  The other thing I did as part of this setup was to create a Virtual Directory.  The Virtual Directory allows you to specify a Virtual Path for a directory that contains files you want to serve which aren't necessarily in the same directory as your Default Web Site. It basically lets you add an additional directory to the path in the URL, for example http://localhost/SampleWebSite.

No comments:

Post a Comment