Forum Discussion

David Levine's avatar
David Levine
Brass Contributor
Aug 27, 2019

Manage IIS Settings via ApplicationHost.Config vs. Web.Config

I have an IIS setup where multiple websites exist that all share the same document root. Each of the websites have a specific default document though. 

This has been managed in the past by manually editing the applicationHost.config file, adding a section like

<location path="<a href="http://www.website3.com" target="_blank">www.website3.com</a>">
  <system.webServer>
    <defaultDocument>
      <files>
        <add value="website3-home.html" />
      </files>
    </defaultDocument>
  </system.webServer>
</location>

 

I am trying to script some of this setup, and I am trying to use the WebAdministration powershell module, and am looking at AppCmd, but when I try to set a Default Document setting this way, the setting gets added to Web.Config... and since the websites have a shared document root, they all share the same Web.Config, and this causes a problem.

 

Is there a way when using WebAdministration or AppCmd to specify that I want the change made specifically in applicationHost.config, not Web.config?

 

I appreciate any suggestions!

~D

 

Resources