Tuesday, March 27, 2012

Unrecognized attribute ‘targetFramework’ when deploying asp.net 4.0

after hosting a site in IIS 7.0 , while accessing any server pages, i got the below error..
"Unrecognized attribute ‘targetFramework’ when deploying asp.net 4.0"

is most likely because of either of 2 reasons:

1. You installed the .net 4.0 bits after IIS was set up, resulting in the wrong version of the .NET framework beeing registered with IIS.

Most often the above results in conflicting versions of the framework, and so the easiest way of solving this is to re-register the .NET extensions with IIS using the aspnet_regiss tool. Make sure you run it from an elevated command prompt and that you use the correct version (in the v4.xx folder that is, not the v2.xx one). On my dev machine this tool is located in:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319
and you run it with the -iru flags like so:
aspnet_regiis.exe -iru
then just restart the IIS if possible.

2. You haven’t set the framework of the IIS application to the correct version of .NET (4.0 that is)

Change this using either the IIS(7.) Manager or the command line. In IIS Manager you select ‘Application Pools’, just double click and you will get a pop up as in the image and change as per the highlighted one in the image.

Hope this helps...

yes.sudhanshu

No comments:

Post a Comment