0

Running IIS 10 on a windows 2019 server I have 1 web site and under there I have 20+ applications running. I have been trying to create a default document for each of the sub applications however, ever time I edit one of the sub application it changes for all the applications, not just the specific one I want edited.

The IIS tree looks something like:

  • www.companysite.com (Site)
    • Company1 (Application)
    • Company2 (Application)
    • Company3 (Application)
    • etc. (Application)

I initially tried going to each sub application, opening up Default Document and selecting the Add... option which, as mentioned, would change for all applications.

In the applicationHost.config file at the bottom I tried to manually enter the following, making an entry for each and this also did not work. It seems to only read the first entry and use for all applications:

<location path="www.companysite.com/Company1">
    <system.webServer>
        <defaultDocument enabled="true">
            <files>
                <add value="Company1LandingPage.asp" />
            </files>
        </defaultDocument>
    </system.webServer>
</location>

I even had a clear tag in there after the files entry and that did not help. Thoughts?

My web.config file has not been touched and has the following:

<configuration>
<system.webServer>
    <defaultDocument>
        <files>
            <clear />
            <add value="Default.htm" />
            <add value="Default.asp" />
            <add value="index.htm" />
            <add value="index.html" />
            <add value="iisstart.htm" />
            <add value="default.aspx" />
        </files>
    </defaultDocument>
</system.webServer>
TMcXerox
  • 9
  • 1
  • Does your change url when you access other application? such as `www.companysite.com/Company1` or `www.companysite.com/Company2`. – samwu Jan 10 '22 at 03:02
  • No. All companies use same application with different landing pages within same folder. Additionally they will use different css file for cosmetics on site. – TMcXerox Jan 10 '22 at 12:54
  • Note: I have seen this before and know it is possible, just not sure how. – TMcXerox Jan 10 '22 at 12:54

1 Answers1

0

The problem seems to be with your configuration, how did you set the default document for each sub application? In my iis, each sub application has its own web.config file. Their file list names(<add value="" />) should be in separate web.config files, should be like below config, not your above setting.

Application1:

<configuration>
  <system.webServer>
    <defaultDocument>
        <files>
            <add value="Default.htm" />
        </files>
    </defaultDocument>
  </system.webServer>
</configuration>

Application2:

<configuration>
  <system.webServer>
    <defaultDocument>
        <files>
            <add value="Default.asp" />
        </files>
    </defaultDocument>
  </system.webServer>
</configuration>

enter image description here

samwu
  • 3,857
  • 3
  • 11
  • 25
  • I tried to setup each sub application default document using the IIS GUI by going into the sub application then opening up the Default Document for that sub application and selecting the Add... link on the right. My application uses the same Web.Config for all sub applications. I only have 1 since they all point to the same folder. – TMcXerox Jan 11 '22 at 12:39
  • The problem is obvious, if all your sub applications point to the same folder, then only the first entry in your default document work. – samwu Jan 12 '22 at 09:58
  • I disagree, mainly because I have seen this work in II7, just not sure how they did it. – TMcXerox Jan 12 '22 at 20:41
  • You can test it yourself, as shown above, if the sub applications point to the same folder, then the default documents they add must be under the same path, always work only on the latest added default document. – samwu Jan 14 '22 at 08:54