Resolve Unrecognized Attribute 'targetFramework' - 4.5.2 on IIS 7.5

In this blog, we will look into troubleshooting steps need to be followed for resolving unrecognized attribute ‘targetFramework’ error, while browsing a website hosted on IIS 7/7.5.

error

Above error message showing, it can’t understand target framework 4.5.2. You may face this issue after publishing web site on IIS. From highlighted section in error message, we know that application pool [w3wp.exe] running our web site is running on .NET 2.0.

Let’s open IIS Manager -> Application Pools -> Click on App pool running web site than configure it to run on .NET 4.0:

App pool

As well, ensure “Enable 32 bit applications” is true for the application pool, if your web site\assembly is built on 32-bit by clicking on Advanced Settings of App pool:

settings

If you have migrated web site from IIS 6 to IIS 7/7.5, it is better to run app pool in classic mode [compatible with IIS 6] and resolve issues [if any] than set pipeline mode to integrated mode. Ensure .NET 4.5.2 is also installed.

Now, check whether .NET 4.5.2 is registered with IIS or not by going to 4.0 framework folder in command prompt and running aspnet_regiis command. This command is helpful in registering\removing ASP.NET with IIS.

run

As you can see, it is not listing .NET 4.0. Let’s register it using aspnet_regiis –iand re-fresh the page:

cmd

I am ending the things here, I hope this blog will be helpful for all.

Ebook Download
View all
Learn
View all