Compartilhar via


Walkthrough: Creating ASP.NET Web Application Root Directories in IIS 6.0

The steps in this walkthrough show you how to mark a directory as an application root directory using Internet Information Services (IIS) 6.0. The walkthrough tells you how to create a virtual directory and set the C:\Inetpub\Wwwroot directory as the root directory for your application.

Note

Though ASP and ASP.NET pages will run in a virtual directory that is not an application root, creating an application on the virtual directory changes the values of certain server variables (APPL_PHYSICAL_PATH, APPL_MD_PATH). These server variables allow ASP and ASP.NET to work with application-scoped features, such as the expected location of a Global.asa file or Global.asax file.

Create the Physical Directory

To prepare for this walkthrough

  • Create a new physical directory. The first section of this walkthrough uses the directory C:\exampleWebApp.

  • Create a new physical directory in the C:\Inetpub\Wwwroot directory. The second section of this walkthrough uses the directory C:\Inetpub\Wwwroot\exampleWebApp.

Open IIS Manager

Open Internet Information Services (IIS) Manager by following one of the procedures described in How to: Open IIS Manager.

Create a Virtual Directory Mapping

Use the following procedure to create a virtual directory that is mapped to physical directory that is not in the C:\Inetpub\wwwroot folder. Creating a virtual directory in this way automatically creates a Web application on the virtual directory.

To create a virtual directory

  1. In IIS Manager, expand the local computer node (which might be indicated by your computer name), expand Web Sites, and then click Default Web Site.

  2. On the Action menu, click New, and then click Virtual Directory.

  3. In the Virtual Directory Creation Wizard, click Next.

  4. In the Alias box, type the name that you want for your new application, and then click Next.

  5. In the Path box, type the physical directory that you created to prepare for this walkthrough, C:\exampleWebApp, and then click Next.

    Alternatively, you can click the Browse button to browse to your directory.

  6. On the Access Permissions page, make sure that the Read and Run scripts check boxes are selected, and then click Next.

    Security noteSecurity Note

    Read and Run are the only permissions that are required to run ASP and ASP.NET pages. It is recommended that you use the minimum necessary permissions to allow clients to view your Web site. For more information, see Securing Sites with Web Site Permissions in the IIS Operations Guide.

  7. Click Finish.

    Your new Web application is created and highlighted in IIS Manager.

Make an Existing Virtual Directory a Web Application

You can also create an application root directory from an existing directory in Inetpub\Wwwroot. All physical directories under Inetpub\Wwwroot are treated as virtual directories by IIS, but they are not considered applications until the following procedure is used.

To mark an existing virtual directory in Inetpub\Wwwroot as a Web application using IIS

  1. Open IIS Manager and browse to the Default Web Site as shown in the previous procedures.

  2. Expand the Default Web Site node and look for the subdirectory that you want to designate as an application root. For this example, this is exampleWebApp.

    If IIS Manager was already open when you created the physical directory, you might have to click the Refresh button in IIS Manager to view your new exampleWebApp subdirectory.

  3. Right-click the directory that you want to mark as an application root, and then click Properties.

  4. On the Directory tab, in the Application Settings section, click Create.

  5. In the Application name text box, type the name of the application, and then click OK.

    The virtual directory is now an application root.

See Also

Tasks

How to: Create and Configure Virtual Directories in IIS 5.0 and 6.0

How to: Create and Configure Local ASP.NET Web Sites in IIS 6.0