Pauly
Pauly

Reputation: 1641

Steps to Investigate Cause of Web.Config Duplicate Section

Symptoms

"There was an error while performing this operation....   Filename... web.config...    Error: There is a duplicate..."

Infrastructure

Things Tried

Question

Upvotes: 41

Views: 31421

Answers (7)

Rob Allen
Rob Allen

Reputation: 2921

My issue was quite different and this will depend on what section is a duplicate.

For instance I had a duplicate loggingConfiguration section which appear to be the result of the parent and child app using different versions of Microsoft Enterprise Library

Upvotes: 1

Pure.Krome
Pure.Krome

Reputation: 86957

If you're using DotNetOpenAuth library in your website AND your website is a .NET 4.0 app, then you need to make sure this line is NOT in your web.config

<section name="uri" type="System.Configuration.UriSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

I installed DNOA using NuGet, and it automatically added that line into my web.config file. So I had to remove it.

BTW people, if you using the built in (hella-crappy) visual studio development server (aka Cassini) .. you will not get this problem/issue. It's only when u move your code over to IIS7 express or full IIS7 will this issue occur.

So delete that single line and then have a happy dance.

Upvotes: 7

Victor Rodrigues
Victor Rodrigues

Reputation: 11711

This MS troubleshooting might help also: http://support.microsoft.com/kb/942055

Upvotes: 1

graffic
graffic

Reputation: 1412

The solution is to change your machine.config.

  1. Move the sections to the machine.config for ASP.NET 2.0
  2. Or Remove the sections from the machine.config for ASP.NET 4.0

Here the people from www.asp.net give a posible fix: http://www.asp.net/learn/whitepapers/aspnet4/breaking-changes

Take a look :)

Upvotes: 3

Mike
Mike

Reputation: 31

In IIS 7 change the Application Pools setting for the appPool named "Classic .NET AppPool" to V2.0. Do this by right clicking the Classic .NET AppPool and selecting "Basic Settings..." then reset the .NET Framework Version to V2.0.xxxxx. Recycle the app pool and restart the web site and it should work fine.

Upvotes: 3

Kev
Kev

Reputation: 119806

It might be worth opening up the applicationHost.config file:

C:\Windows\System32\inetsrv\config\applicationHost.config

Specifically, look for <location> tags that match the site name (there can be multiple entries) and see if there's duplicate scriptResourceHandler sections declared there. I'd also check the contents of <location path=""> as well.

Upvotes: 0

Pauly
Pauly

Reputation: 1641

Add this to the checklist.

  • Make sure that the machine.config you check is from the same Dot Net framework as the application pool your application is running under.

In my case the default application pools was changed from Dot Net 2.0 to Dot Net 4.0. This changed the root machine.config to the 4.0 version. This version contains the "scriptResourceHandler" section as well as others. Thus the duplicate section warning.

Upvotes: 36

Related Questions