Export (0) Print
Expand All

How to: Create IIS Virtual Directories in Visual Studio

If you have Internet Information Services (IIS) running on your local computer, you can create an IIS virtual directory that points to files in a location outside of the default IIS folder structure (which is typically \Inetpub\wwwroot). You can create an IIS virtual directory for a local IIS Web site project, a local IIS Web application project, or a remote IIS Web site project. A virtual directory is useful when you want to run pages in an existing folder.

NoteNote

You must be a member of the Administrators group on the local computer to create a virtual directory.

To create a local IIS virtual directory for a Web Site Project

  1. In Visual Studio, on the File menu, click New and then click Web Site.

  2. In the New Web Site dialog box, click Browse.

  3. In the Choose Location dialog box, click the Local IIS icon.

  4. In the tree control, select Default Web Site, or the folder in which you want to create a virtual directory.

  5. In the top-right corner of the Choose Location dialog box, click the Create New Virtual Directory button. (There is no text on this button, but the text appears when you place the mouse over the button.) This creates an IIsWebVirtualDirectory administration object in IIS.

    NoteNote

    Alternatively, you can click the Create New Web Application button, which will also create a virtual directory (an IIsWebDirectory administration object in IIS), but it will not give you the option to map the virtual directory to a different physical directory. For more information, see the topic "Metabase Structure" in the IIS SDK.

  6. In the Alias name text box, type the name for your virtual directory.

  7. In the Folder text box, type the fully qualified path to the physical directory where your files are located, or click the Browse button to browse to the location, and then click OK.

    NoteNote

    If you want clients to be able to browse to your Web pages, the access control list (ACL) configured on the physical directory needs to include Read and Execute permissions for the IIS_WPG account and the Internet Guest Account. For more information, see the topic "Access Control with IIS 6.0" in the IIS Operations Guide.

    You can continue to create or delete virtual directories in the Choose Location dialog box. When you are ready to create a Web site project, you can select the location in the tree control and click Open.

To create a local IIS virtual directory for a Web Application Project

  1. In Visual Studio, open an existing Web application project, or create a new one.

  2. In the Project menu, click Properties, and then click Web.

  3. Click Use Local IIS Web server.

  4. Enter a URL for the project, and then click Create Virtual Directory.

To create a remote IIS virtual directory for a Web Site Project

  1. In Visual Studio, on the File menu, click New and then click Web Site.

  2. In the New Web Site dialog box, click Browse.

  3. In the Choose Location dialog box, click the Remote Site icon.

  4. In the Web site location text box, click New Web Site.

  5. In the Web URL text box of the Create New FrontPage Web dialog box, type the URL to the remote IIS server and append the name of the virtual directory that you want to create, for example, http://<server name>/<new virtual directory name>.

  6. Click OK.

    NoteNote

    If an authentication dialog box opens, type your user name and password, and then click OK. You must use an account that has Create permissions on the server.

  7. In the Choose Location dialog box, click Open.

  8. In the New Web Site dialog box, click OK.

    A new Web site project is created for your new remote virtual directory. The virtual directory is created as an IIsWebDirectory administration object in the Default Web Site of the IIS server. For more information, see the topic "Metabase Structure" in the IIS SDK.

    Depending on your connection speed and processor speed, authoring a site remotely can be slower than authoring one locally. As an alternative, you can author your site locally as a test Web site and then deploy your test site to the remote location. For more information about how to deploy Web sites, see ASP.NET Deployment Content Map.

Community Additions

ADD
Show:
© 2014 Microsoft