Search code examples
asp.net.netiisapplication-pool

IIS AppPool configured to use .NET Framework 4.0 is still using 2.0


I have to run an ASP.NET application that uses .NET 4.0, so I created a new Web Site in IIS Manager (inetmgr.exe) and set its Application Pool to ASP.NET v4.0, here is a screenshot with the description of the AppPool:

AppPool configuration

Here is a screenshot of how i configurated the web site:

WebSite configuration

But when I navigate to the website i get this error

Navigation error

In english is

Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.

This error happens when you run an ASP.NET 4.0 application in 2.0 AppPool, and from the screenshot you can also notice

.NET Framework:2.0.50727.5456

Why is it running .NET 2.0? What am I doing wrong in my configuration? I also tried aspnet_regiis.exe -ir even for .NET 4.0 and 2.0, but without success


Solution

  • Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.

    That appears with .NET 4 when a later version (eg. 4.5.2) is not installed. The attribute is added in .NET 4.5 (so the ASP.NET loader knows to load a later version of the 4 series).

    If you do not have .NET 4.5 or later installed the loader doesn't know what to do with that attribute.

    (.NET 4.5.2 has been pushed out on Windows Updates: IMHO servers really should be running at least that version by now: it contains significant bug fixes over .NET 4. Particularly so if new web apps are being deployed.)

    I assume the V2 appearing on the YSOD is due to fallback having failed to load under .NET 4.