Creating virtual directories and web applications
Virtual directories and web applications are the different options to contain content in IIS. A virtual directory is a pointer to a location on the disk where the content actually resides. A web application, in the IIS terminology, is a virtual directory that also has the ability to run in a different worker process than its parent.
To create a virtual directory, we will use the New-WebVirtualDirectory
cmdlet and supply the –Name
and –PhysicalPath
parameters. Also, we will need to specify the site and we can do this in one of the following two ways:
Use
Set-Location
(CD
) in the IIS drive and navigate to the desired site.Specify the site on the command line.
In the following screenshot, we will illustrate the first method:
If you are working with a website besides the default site (Default Web Site
), you will need to set the location to this site. For instance, to create a virtual directory in the Test site, you would use Set-Location IIS:\Sites...