ASP.NET中禁止继承IIS中web.config根目录的配置

异常信息:

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

Parser Error Message: The entry 'XXXXX' has already been added.

此错误一般是访问虚拟目录时抛出的异常 导致此异常的原因是因为虚拟目录中项目默认继承了主站的配置文件出现配置冲突

解决方案:在主站配置文件中禁止继承允许重写

  <configuration>

<configSections> </configSections>

      <location path="." allowOverride="true" inheritInChildApplications="false">

        <system.web>

          <httpModules></httpModules>

      </system.web>

    </location>

  </configuration>

原文地址:https://www.cnblogs.com/huaguduo/p/4649510.html