.net – ‘System.Web.Extensions’ trouble deploying .Net Framework 4 Website on IIS7

.net-4.0asp.netiisiis-7net

I am trying to deploy a .Net framework 4 website on IIS7 server. I have already changed the application-pool's target framework to .Net 4, but the app is still showing me the error:

"The configuration section 'system.web.extensions' cannot be read because it is missing a section declaration"

I am guessing that has something to do with the new feature of .Net4 that lets me have a compact Web config file. I think for some reason IIS7 is not happy with this.

What can I do to deploy this app successfully or do I have to scale back to v3.5? I am sure there is a solution out there.

Do you have any suggestions?

Best Answer

You can also get this very same error if you create a new website in IIS 7(.5) as the application pool it creates for the new site may still be set to 2.0, and as such, system.web.extensions is not valid in a 2.0 configuration file.

Simply go into IIS Manager, choose the application pools, select the one for your app, right-click, Advanced Settings and set .NET framework version to v4.