Wednesday, December 15, 2010

Install IIS 7.5 on Windows 7

Here are the quick steps for installing IIS 7.5 on Windows 7 Professional/Enterprise/Ultimate. While Microsoft’s TechNet does have an entry it’s not the most informative or person-friendly (person being different than a techie geek). This post is a companion to the How To series on building a 2-tier ASP.NET 4.0 web site (part 1, part 2, part 3).

  1. Navigate to Control Panel | Programs | Turn Windows features on or off:
    2010-12-01_223350
    2010-12-01_223854
    2010-12-01_223914
  2. Check the box next to Internet Information Services and then expand the sub-tree by clicking the (+) plus sign next to it:
    2010-12-01_223942
  3. Continue expanding the sub-tree until you open Application Development Features then check the box for ASP.NET:
    2010-12-01_224027
  4. Further down, expand Security then enable Basic Authentication and Windows Authentication:
    2010-12-01_224124
    2010-12-01_224136
    Clicking OK to close the dialog out will cause the computer to install and pre-configure IIS, taking several minutes to complete.
  5. After IIS is installed you’ll find a new set of folders has been created:
    2010-12-01_225259
    C:\inetpub\wwwroot is the default “root” folder for IIS (a.k.a. world wide web server) so this path is the default location to place websites. The key fact here is that if you publish into this folder you won’t have to worry about folder (NTFS) permissions. Publishing to the default personal user location that Visual Studio selects – within your “My Documents” folder means you need to take an extra step of granting IIS permission to access those folders in your documents area. This screenshot from IIS Manager shows the default web site along with the path matching the path shown above:
    2010-12-01_230027
  6. Next we’ll configure Application Pools that will host and execute the ASP.NET applications. Launch IIS Manager from Control Panel | Administrative Tools | Internet Information Services (IIS) Manager:
    2010-12-01_225342
    2010-12-01_225416
    Hint: IIS Manager is the configuration tool for IIS and you’ll be jumping into it often. You can use the Run dialog for faster access via the Windows + R then typing “inetmgr”:
    2010-12-01_225504
  7. When you select the Application Pools entry in the tree control you should see the following:
    2010-12-01_225613
    However, a standard configuration of IIS 7.x on Windows Server 2008 R2 looks like this:
    2010-12-01_225822
    Notice that the server installation contains two additional application pools configured for ASP.NET v4.0.
  8. Let’s configure our personal machine (desktop/laptop) in the same manner to enable more realistic local testing. Right-click on the Application Pools entry in the tree control and choose Add Application Pool:
    2010-12-01_225857
    After adding the integrated mode, repeat the steps to add a classic mode pipeline:
    2010-12-01_225931
  9. Since IIS was not installed and ASP.NET was already present in Windows 7, we must manually register the “handler” for ASP.NET pages and content so IIS can correctly map web requests. To do so open a command prompt running as Administrator – necessary because this type of registration requires elevated permissions. To open a command prompt as Administrator click the Start button, type in “command” and wait a moment until it shows the Command Prompt under the Programs section then right-click and select Run as administrator as shown here:
    2010-12-01_234807
  10. With the command prompt open execute two commands by typing in each of the following and pressing Enter after each command:
    2010-12-01_235058

    cd  %windir%\Microsoft.NET\Framework\v4.0.*
    aspnet_regiis.exe –i

    Note that the last four digits of the build number (30319 shown above) are less important. You may have a different version depending on the service pack level and patches installed in your computer.

That’s it – you’ve installed IIS, enabled common security features and created application pools designed to host ASP.NET 4.0 websites.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.