Search code examples
iisiis-8virtual-directory

How to create a virtual directory from file in IIS 8.5


I want to import virtual directory setting via file in IIS 8.5, but cannot find an option to do so. In IIS 6 you can:

Right click on the site -> New -> Virtual Directory (From File)

I do not see this option in IIS 8.5, only an option to 'Add Virtual Directory...'

Google is not helping today. Does anyone know how this can be accomplished?


Solution

  • I was not able to find a way to do this similar to how you can in IIS 6, maybe there is a powershell command...

    However, I did find a way to add sites via the applicationHost.config file, which is usually located at: C:\Windows\System32\inetsrv\config. (be sure to make a back up of the file in case you make a booboo).

    Since I have similar sites and apps, it is was easy to copy and paste, and modify the necessary fields.

    You can add sites and app pools in the section:

    <system.applicationHost>
    

    App Pools:

    <applicationPools>
    ...
    

    Sites:

    <sites>
    

    If you have applications under a site then there has to be a corresponding location node:

     <location path="Default Web Site/yoursiteapp">
            <system.webServer>
                <security>
                    <authentication>
                        <windowsAuthentication enabled="true" />
                        <anonymousAuthentication enabled="false" />
                    </authentication>
                    <access sslFlags="None" />
                </security>
            </system.webServer>
        </location>