Unrecognized attribute ‘targetFramework’ error

Yesterday while publishing a WCF Service to IIS I got this error from the VS2010 auto generated web.config file.

<compilation debug="true" targetFramework="4.0">

After searching I found it is because of the Framework version setting in the Application Pool of the web application.

In IIS 7, you can modify the application pool by selecting the Application Pools node from left side bar, and Select the Basic Settings, which will bring the Edit Application Pool dialog, where you can choose the .Net Framework Version. To fix the issue, it should set to version 4.x

Edit Application Pool Dialog

Edit Application Pool Dialog

2 thoughts on “Unrecognized attribute ‘targetFramework’ error

  1. Good point, that works (as long as one has upgraded IIS with .net 4 and to do that, one will need to add roles / features with Server Manager if running win server 2008)

Leave a Reply

Your email address will not be published. Required fields are marked *



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>