>
 



Earlier, I posted a step by step guide on Creating IIS7 sites, applications, and virtual directories using Internet Information Services Manager. In the article, I created a new website named “bloggingdeveloper” and created a single HTTP binding configured to listen on all interfaces, port 81, and without a host-header restriction. The site was accessible via http://localhost:81/. 

Serving over Port 81
Serving via http://localhost:81/


In this step by step tutorial, I will describe accessing a local site via name (e.g. http://bloggingdeveloper/) using the Hosts file.

  1. Start IIS Manager

      To start IIS Manager from the Run dialog box
    1. On the Start menu, click Run.
    2. In the Open box, type inetmgr and then click OK.

      To start IIS Manager from the Administrative Services console
    1. In the Control Panel window, click Administrative Tools.
    2. In the Administrative Tools window, click Internet Information Services (IIS) Manager.

  2. Internet Information Manager 7.0
    Internet Information Manager 7.0


  3. Select your site (bloggingdeveloper) from the left side and select Bindings from the right side under the Edit Site section.

  4. IIS Bindings
    IIS Bindings


  5. In the bindings window Click Add, enter 127.0.0.2 as the IP Address, leave the host header empty and click OK.

  6. IIS Add Bindings
    IIS Add Bindings


  7. Edit the Hosts File

    1. Browse to Start -> All Programs -> Accessories
    2. For Windows Vista Users : Right click "Notepad" and select "Run as administrator"
    3. Click "Continue" on the UAC prompt
    4. Click File -> Open
    5. Browse to "C:\Windows\System32\Drivers\etc"
    6. Change the file filter drop down box from "Text Documents (*.txt)" to "All Files (*.*)"
    7. Select "hosts" and click "Open"

    8. Unedited Hosts File
      Unedited Hosts File


    9. To the end of the file add the following line:

    10. 127.0.0.2 bloggingdeveloper

      Edited Hosts File
      Edited Hosts File


    11. Close Notepad. Save when prompted.

  8. If you skip Step b in Windows Vista and try to modify your hosts file, it will not let you save it. It tells you that you don't have permission. To successfully modify the hosts file, run notepad.exe as an administrator.

    Error when trying to save hosts file without administrative privilages
    Error when trying to save hosts file without administrative privilages


    You may use any IP Address between 127.0.0.2 and 127.0.0.254.

  9. Browse your site via http://bloggingdeveloper/

  10. Serving via http://bloggingdeveloper
    Serving via http://bloggingdeveloper


Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5



After Migrating the application to work with the Integrated .NET mode, you might come across a problem: Server Error in Application "WebSiteName" - HTTP Error 401.3 – Unauthorized 

HTTP Error 401.3 – Unauthorized
HTTP Error 401.3 – Unauthorized


Resolving HTTP Error 401.3 – Unauthorized Error
Resolving HTTP Error 401.3 – Unauthorized Error


Click on Authentication and click edit after choosing Anonymous Authentication. In the opening window select Application Pool identity and click OK.

Resolving HTTP Error 401.3 – Unauthorized Error - Application Pool Identity
Resolving HTTP Error 401.3 – Unauthorized Error - Application Pool Identity

 

Currently rated 4.9 by 10 people

  • Currently 4.9/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5



You might have come across to the following “HTTP Error 500.0 - Internal Server Error” while working on Windows Vista. 

HTTP Error 500.0 - Internal Server Error
HTTP Error 500.0 - Internal Server Error


Follow the directions shown on the error message to resolve the problem:

You can migrate the application configuration, including the contents of the configuration section, by using the following from a command line window (the window must be running as Administrator):

%systemroot%\system32\inetsrv\APPCMD.EXE migrate config "bloggingdeveloper/"

1) Migrate the application to work with the Integrated .NET mode (PREFERRED).

You can migrate the application configuration, including the contents of the configuration section, by using the following from a command line window (the window must be running as Administrator):

%systemroot%\system32\inetsrv\APPCMD.EXE migrate config "bloggingdeveloper/"

After you migrate your application, it will run in both Classic and Integrated .NET modes, as well as on downlevel platforms.

2) Move this application to an application pool using the Classic .NET mode.

You can move the application to the default application pool using the Classic .NET mode by running the following from an command line window (the window must be running as Administrator):

%systemroot%\system32\inetsrv\APPCMD.EXE set app "bloggingdeveloper/" /applicationPool:"Classic .NET AppPool"

Alternatively, you can use any other application pool on your system that is running in the Classic .NET mode. You can also use the IIS Administration tool to move this application to another application pool.

Currently rated 5.0 by 3 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5



You might have come across to the following “HTTP Error 500.19 - Internal Server Error” while trying to create IIS 7.0 web site on Windows Vista. Actually Microsoft has tightened the security on Windows Vista and most of the time it is annoying when it asks your permission. 

HTTP Error 500.19 - Internal Server Error
HTTP Error 500.19 - Internal Server Error


To resolve this problem:

Compile the project and place the deployable files under C:\Inetpub\wwwroot\. Make sure that the physical path of the respective Application (e.g. BloggingDeveloper in above error case) under IIS now points to new path.

OR

Browse your application root folder and add group IIS_IUSRs.

Resolving HTTP Error 500.19 - Internal Server Error
Resolving HTTP Error 500.19 - Internal Server Error

 

Currently rated 5.0 by 4 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories : IIS 7.0 | Errors | All
Share & Support : del.icio.us | DZone it! | Kick it! | digg it! | Furl | Technorati



According to Microsoft, Internet Information Services 7.0, or IIS7, is the most advanced, secure and customizable platform for developing and reliably hosting Web applications and services. With IIS7, you can create sites, applications and virtual directories to serve requests. In order to serve requests and share information with users over the Internet, an intranet, or an extranet, you need to create a set of configuration that describes how the server listens for requests, and how these requests are handled. 

In this article, I explain the important differences between IIS6 and IIS7 in the way sites, applications and virtual directories work and how to create and configure them in IIS7.

In IIS6, the concepts virtual directory and application are conceptually different. However, an application cannot be physically separated from a virtual directory. Also in IIS6, an application is less important than the technology that extends the web server functionality, such as ASP and ASP.NET. These technologies provide additional features and IIS isolates applications in a way that would prevent applications in one application pool to affect applications that are in another application pool.

On the other hand, in IIS7, virtual directory and application are completely separate objects; they exist in a hierarchical relationship in the configuration schema. A site contains one or more applications; an application contains one or more virtual directories; and a virtual directory maps to a physical location.

Site

A site is a logical container that specifies how http requests are received and processed for applications and virtual directories. It also defines one or more unique bindings that determine how the site listens for incoming http requests.

Bindings

A binding includes two attributes which have key importance for communication: the binding protocol and the binding information. The binding protocol defines the protocol between the server and client. For example, the binding protocol of a web site may be HTTP or HTTPS. The binding information contains the information that is used to access the site. Usually, the binding information is the combination of an IP address, a port number and an optional host header. Only bindings determine which site the request is routed to.

You may host many sites on a single server that listen on:

  • Different IP addresses, different ports
  • Same IP address and port but with different host headers.

The following configuration settings also belong to the site beside applications and bindings:

  • Limits: settings to limit the bandwidth, number of connections
  • Logging: settings for handling and storage of log files.
  • Failed Request Trace Logs: settings for logging failed request traces

An application is a logical container of a site’s functionality. 

Basic steps to serve a website using IIS7 contain:

  1. Creating a site
  2. Creating an application
  3. Creating a virtual directory
  4. Creating an application pool


Although IIS7 comes with “Default Web Site” serving on Port 80 for all host headers and single application located in %systemdrive%\inetpub\wwwroot, we may have multiple websites serving over different domain names/ports, or we may want to place a part of a website into a different application pool, or we may have different ASP.NET applications, or we may want to serve a part of a website from a different physical location by creating a different virtual directory.

Let’s start with creating a new website that will be served over port 81 of the localhost. 

This post will show how to do add new website from the Internet Information Services Manager, but you can do these by using the IIS7’s AppCmd.Exe command line tool, located in %windir%\system32\inetsrv. 

To start IIS Manager from the Run dialog box

  1. On the Start menu, click Run.
  2. In the Open box, type inetmgr and then click OK.


To start IIS Manager from the Administrative Services console

  1. In the Control Panel window, click Administrative Tools.
  2. In the Administrative Tools window, click Internet Information Services (IIS) Manager.

Internet Information Services(IIS) Manager
Internet Information Services(IIS) Manager


To create a new website using IIS Manager, click on the Web Sites under Connections and then click on the Add Web Site link under Actions.

Adding a new website using IIS Manager
Adding a new website using IIS Manager


In the Add Web Site window:

  1. Type your web site name.
  2. Select Physical path of your web site.
  3. Type 81 as your port number.
  4. Click OK.

Settings properties of the website
Settings properties of the website


This creates a new website named “bloggingdeveloper”, with id = 2, and creates a single HTTP binding configured to listen on all interfaces, port 81, without a host-header restriction. At this point, you can immediately access the site with http://localhost:81/.

You might have come across to the following “HTTP Error 500.19 - Internal Server Error” while working on Windows Vista. Actually Microsoft has tightened the security on Windows Vista and most of the time it is annoying when it asks your permission.

HTTP Error 500.19 - Internal Server Error
HTTP Error 500.19 - Internal Server Error


To resolve this problem:

Compile the project and place the deployable files under C:\Inetpub\wwwroot\. Make sure that the physical path of the respective Application (e.g. BloggingDeveloper in above error case) under IIS now points to new path.

OR

Browse your application root folder and add group IIS_IUSRs.

Resolving HTTP Error 500.19 - Internal Server Error
Resolving HTTP Error 500.19 - Internal Server Error


After granting permission to the application root folder, you might come across another problem: Server Error in Application "bloggingdeveloper" - HTTP Error 500.0 - Internal Server Error.

HTTP Error 500.0 - Internal Server Error
HTTP Error 500.0 - Internal Server Error


Follow the directions shown on the error message to resolve the problem:

You can migrate the application configuration, including the contents of the configuration section, by using the following from a command line window (the window must be running as Administrator):

%systemroot%\system32\inetsrv\APPCMD.EXE migrate config "bloggingdeveloper/"

1) Migrate the application to work with the Integrated .NET mode (PREFERRED).

You can migrate the application configuration, including the contents of the configuration section, by using the following from a command line window (the window must be running as Administrator):

%systemroot%\system32\inetsrv\APPCMD.EXE migrate config "bloggingdeveloper/"

After you migrate your application, it will run in both Classic and Integrated .NET modes, as well as on downlevel platforms.

2) Move this application to an application pool using the Classic .NET mode.

You can move the application to the default application pool using the Classic .NET mode by running the following from an command line window (the window must be running as Administrator):

%systemroot%\system32\inetsrv\APPCMD.EXE set app "bloggingdeveloper/" /applicationPool:"Classic .NET AppPool"

Alternatively, you can use any other application pool on your system that is running in the Classic .NET mode. You can also use the IIS Administration tool to move this application to another application pool.

After Migrating the application to work with the Integrated .NET mode, you might come across another problem: Server Error in Application "bloggingdeveloper" - HTTP Error 401.3 – Unauthorized

HTTP Error 401.3 – Unauthorized
HTTP Error 401.3 – Unauthorized


Resolving HTTP Error 401.3 – Unauthorized Error
Resolving HTTP Error 401.3 – Unauthorized Error


Click on Authentication and click edit after choosing Anonymous Authentication. In the opening window select Application Pool identity and click OK.

Resolving HTTP Error 401.3 – Unauthorized Error - Application Pool Identity
Resolving HTTP Error 401.3 – Unauthorized Error - Application Pool Identity


Now we are ready to browse the website.

Serving bloggingdeveloper in localhost over port 81
Serving bloggingdeveloper in localhost over port 81


If you don’t want to struggle with the above errors, just place the deployable files under C:\Inetpub\wwwroot\.

UPDATE Another step by step tutorial is available about accessing a local site via name (e.g. http://bloggingdeveloper/) using the Hosts file instead of http://localhost:81/.

Accessing Local IIS Web Sites via Name using the Hosts File

Currently rated 4.5 by 4 people

  • Currently 4.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5