Tuesday, February 19, 2013

Configuration error when converting from ASP.Net 3.5 to ASP.Net 4.0

There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined

The above message appeared when we were trouble shooting a staging server. When we looked at our config there was no duplicate section. We really got confused about this and commented out this section and continued testing since the intention of that web.config was to host services rather than web pages.

But the question remained there till our next tea. The idea flashed when somebody said about a bug in Microsoft windows. Suddenly we googled and found the below link.

http://www.asp.net/whitepapers/aspnet4/breaking-changes#0.1__Toc256770149

According to this article, .Net 4.0 moved the some configurations section to the root level (machine.config) which were common in all the .net 3.5 ASP.Net apps. So if we just change the application pool of .Net 3.5 application to .Net 4.0, this error message will popup.So better to convert using Visual Studio 2010 or remove this configuration element manually.

The sad part was the application which we were trouble shooting is supposed to install in a .Net 3.5 app pool.By mistake only it came to ASP.Net 4.0 pool and showed this error. Wasted some time but got a future time saving point.

No comments: