web.Config Error – duplicate scriptResourceHandler section defined

this was the annoying error I was being plagued with today

Config Error There is a duplicate ‘system.web.extensions/scripting/scriptResourceHandler’ section defined

I was getting this error today and it was very annoying but then when you work out what the problem is quite interesting, especially if like me you are studying for the 70-515 .NET web applications exam.

A bit of background.  I had created a website, it was a demo website and in the website it had a sectionGroup with the name of scripting.

<sectionGroup name=”scripting” type=”System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″>

When I tried to run the website it then popped up with the annoying duplicate error.

The way ASP.NET works is you have default settings held in the machine.config.  These are used by all Web sites using that version of .NET, in this case 4.

When you create a website, you can over write the machine.config settings and have local setting specified in your web apps web.config.

 

The reason I was getting duplicate errors was because it was almost the same reference, except one of them was 3.5 and one of them was 4.0.  Depending on what server you have got (in on iis 7) you can find the machine.config somewhere around here

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config

 

local web.config

<sectionGroup name=”system.web.extensions” type=”System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″>

 

machine.config

<sectionGroup name=”scripting” type=”System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″>

 

to solve the problem I deleted the sectiongroup from my local web.config and then the problem went away.

for more information I found these web links useful

http://forums.iis.net/t/1149226.aspx

http://www.britishdeveloper.co.uk/2010/03/there-is-duplicate-systemwebextensionss.html

One thought on “web.Config Error – duplicate scriptResourceHandler section defined

  1. Colin Farr March 11, 2011 / 12:27 am

    Glad you got it sorted and glad if I helped in anyway. Cheers for the link

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.