Microsoft IIS 10.0 – Constructing a virtual directory in IIS 10.0

Getting Started with the IIS Manager in IIS

In this recipe, we are going to create a virtual directory step by step. We will add the alias of the virtual directory (alias is the virtual name of a physical directory). We will also apply the settings of the physical path of virtual directory.

Getting ready

To step through this recipe, you will need a running IIS 10.0 instance. You should also have administrative privileges.

How to do it…

  1. Go to the C:drive. We have already created a folder named Websites; under the Websites folder, you have to create a folder called VirtualDirectory, as shown here:
  1. Open the VirtualDirectory folder, and paste in it some of the HTML files we’d hosted in the previous chapter. We are only using Demo.html. You can create your own HTML files:
  1. Next, you have to open Server Manager on Windows Server 2016. Click on the Tools menu and open IIS Manager.
  2. Expand the IIS server ( WIN2016IIS). We get the listed Application Pools and Sites folders.
  3. Expand the Sites folder inside the Connections pane, right-click on, and a context window will pop up. You have to select Add Virtual Directory, as shown here:
  1. In the Add Virtual Directory dialog box, type a name in the Alias text box. This alias is used to access the content from a URL. You have to provide the physical path of the Virtual Directory folder where it is located. In the Physical path text box, type the physical path of the content folder, or click on Browse to navigate through the filesystem to find the folder. In the C:\ drive, a Websites folder is created to map the physical path of the virtual directory. We added this path:
  1. Click on on OK button. Go to the Connections pane, and expand Sites.
  2. Expand under the Sites folder, and you will see a folder added, called VirtualDirectory.
  3. Now you have created a virtual directory, and in the next recipe, we will configure it.

How it works…

In steps 1 and 2, we created a physical folder for a virtual directory, and we uploaded site files to this directory. In steps 3 to 7, we created a virtual directory and understood its workings. Step 8 confirmed that the virtual directory has been created.

Comments are closed.