This is a web.config inheritance problem, and you cannot overcome all problems with the <location> directive.
We received similar errors regarding duplicate configuration directives in one of our applications. After research, it looks like this because of this problem .
In short, our root site is ASP.NET 3.5 (this is 2.0 with specific libraries added), and we have a helper application, which is ASP.NET 4.0.
Inheriting web.config forces the ASP.NET 4.0 sub application to inherit the web.config file of the parent ASP.NET 3.5 application.
However, the ASP.NET 4.0 application is global (or "root") web.config, which is located in C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Config \ web.config and C: \ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ Config \ web.config (depending on your bitness) already contains configuration sections that are present in the web.config application of the .NET 3.5 application.
Then the ASP.NET 4.0 application tries to combine the root ASP.NET 4.0 web.config and the parent web.config (the one used for the ASP.NET 3.5 application), and works with duplicates in the <configSections> node.
The <location> directive cannot be used to prevent the inheritance of <configSections> entries. The only solution I could find was to remove configSections from the parent web.config, and then either
- Determine that you do not need them in the root application, or
- Upgrade the parent application to ASP.NET 4.0 (so that it can access the web.config root configurations)
Josh
source share