次の方法で共有


How to: Create and Configure Virtual Directories in IIS 7.0

By using IIS Manager, you can create a virtual directory for an ASP.NET Web application that is hosted in IIS 7.0. A virtual directory appears to client browsers as if it is in the Web server's root directory, even though it can physically reside somewhere else. This approach enables you to publish Web content that is not located under the root folder of the Web server, such as content that is located on a remote computer. It is also a convenient way to set up a site for local Web development work because it does not require a unique Web site for each virtual directory.

This topic explains how to create a virtual directory and configure it to run ASP.NET pages on versions of that have IIS installed and on Windows Server 2008. For information about how to configure a virtual directory in IIS 5.0, 5.1, and IIS 6.0, see How to: Create and Configure Virtual Directories in IIS 5.0 and 6.0.

You must create a virtual directory as part of an existing IIS Web site. This can be either the default Web site that is created when IIS is installed, or a Web site that you have created. For additional details about how to install and configure IIS and about how to create a Web site, see the IIS Help or the online IIS product documentation on the Microsoft TechNet Web site.

Creating the Virtual Directory

Follow one of the procedures in How to: Open IIS Manager topic to open IIS Manager. You can then create a virtual directory.

To create a virtual directory by using IIS Manager

  1. In IIS Manager, expand the local computer and the Sites folder, and then find the Web site that you want to add a virtual directory for. Use the following steps:

    • For , right-click the site or folder where you want to create the virtual directory, and then click Add Virtual Directory.

    • For Windows Server 2008, right-click the site or folder where you want to create the virtual directory, click Manage Web Site, and then click Add Virtual Directory.

  2. In the Add Virtual Directory dialog box, specify the following information:

    • Alias. Type a name for the virtual directory. Choose a short name that is easy to type, because the user types this name to access the Web site.

    • Physical Path. Type or browse to the physical directory that contains the virtual directory. You can select an existing folder or create a new one to contain the content for the virtual directory.

  3. To provide credentials to connect to a UNC path, click the Connect as button.

  4. Click OK.

For more information, see Managing Virtual Directories in IIS 7.0.

Configuring the Virtual Directory

If ASP.NET functionality is enabled, when you create a virtual directory, it is already configured to run ASP.NET pages. For more information about how to enable ASP.NET functionality in IIS 7.0, see Running Web Applications on Windows Vista with IIS 7.0 and Visual Studio or Running Web Applications on Windows Server 2008 with IIS 7.0 and Visual Studio. The next configuration tasks you might want to perform are to configure security and authentication for your virtual directory.

To configure security for a virtual directory for an existing account

  1. In IIS Manager, select the virtual directory that you want to configure, and then click Edit Permissions in the Actions pane.

    The virtual directory's Properties dialog box is displayed.

  2. Click the Security tab.

  3. Click Edit.

    The Permissions dialog box is displayed.

  4. Select an existing account in the Group or user names list.

  5. Select the appropriate permissions check boxes from the Permissions list for the selected group or user, as required for your virtual directory security.

  6. Click Apply to apply the changes.

  7. Click OK to close the Permissions dialog box.

  8. Click Apply to apply the changes in the Properties dialog box.

  9. Click OK.

To configure security for a virtual directory for an new account

  1. In IIS Manager, select the virtual directory that you want to configure, and then click Edit Permissions in the Actions pane.

    The virtual directory's Properties dialog box is displayed.

  2. Click the Security tab.

  3. Click Edit.

    The Permissions dialog box is displayed.

  4. Click Add to add an account.

    The Select Users, Computers, or Groups dialog box is displayed.

  5. Add a user, computer, or group as required for you virtual directory security.

  6. Click OK to close the Select Users, Computers, or Groups dialog box.

  7. Select the appropriate permissions check boxes from the Permissions list for the new user, computer, or group, as required for your virtual directory security.

  8. Click Apply to apply the changes.

  9. Click OK to close the Permissions dialog box.

  10. Click Apply to apply the changes in the Properties dialog box.

  11. Click OK.

To configure authentication for a virtual directory

  1. In IIS Manager, select the virtual directory that you want to configure.

  2. In Features View, double-click Authentication.

  3. Select the authentication type to configure, and in the Actions pane make sure Enable is selected in order to enable the authentication type.

    If the authentication type is already enabled, the Actions pane enables you to disable or edit authentication configuration.

  4. In the Actions pane, click Edit or Advanced Settings to configure additional properties for the authentication type you selected.

    The actions available in the Actions pane vary depending on the authentication type you selected. For example, if the Anonymous Authentication module is installed and is enabled, you can click Edit to edit additional properties of anonymous authentication. If the Window Authentication module is installed and is enabled, you can click Advanced Settings to edit properties of windows authentication.

For more information about configuration authentication, see Configuration Authentication in IIS 7.0. For a list of other common administrative tasks, see Common Administrative Tasks.

See Also

Tasks

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

Concepts

Moving an ASP.NET Application from IIS 6.0 to IIS 7.0