Recently I started working on a .Net 4.0 project at work.  I was ready to deploy this locally and then to a test environment so a few other people could run through the UI and make sure it made sense.  So I had the Application set up in IIS and deployed my code.  Upon going to the site though, I was greeted by a lovely 500 Server Error.  The error was low on info and basically informed me that there was an issue with the config file: 
  .Net 4 500 Server Error

“The configuration section ‘system.web.extensions’ cannot be read because it is missing a section declaration” sounds a lot like an issue with my web config doesn’t it?   It wasn’t, not really anyway.  Fortunately I had deployed this site prior to converting it from .Net 3.5 to .Net 4.0 and it worked fine.  So I started to think, much like when we had to switch sites from .Net 1.1 to 2.0 in order to host 2.0 (and higher apps) in IIS 6, there was probably somewhere in IIS 7 for me to change my App from .Net 2.0 to 4.0.  And indeed, there is in the App Pool:

App Pool Framework Version

Once you change the framework version from 2.0 to 4.0, the “incorrect” config errors disappear.  So if you’re just starting to get into .Net 4.0 web sites, make sure you keep in mind that your App Pool is probably still set to run under .Net 2.0 and you do need to switch to 4.0.

Chris Risner

Leave a Comment