How to Fix Unrecognized attribute targetFramework. Note that attribute names are case-sensitive." on IIS 7.5

We may get below error after publishing your website on IIS 7.5:

Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.

To fix it, we need to follow below troubleshooting steps:

  1. Check on which .NET version, the application is developed. Let's assume, it's .NET 4.0.
  2. Open IIS Manager and find the Application Pool, on which your website is hosted.
  3. Go to that Application Pool and check the .NET version and change it to 4.0 accordingly by clicking on Basic\Advanced Settings.
  4. If .NET 4.0 is not listed, go ahead and install it.
  5. If it still won't show up, go to command prompt and fire below command to find list of ASP.NET versions installed:

    C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -lv
  6. In the output, if .NET 4.0 is not listed. Register it by firing below command:

    C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -I.
  7. It should show up .NET 4.0 in the .NET Framework Version dropdown for the application pool.
  8. Please refer here for more details on aspnet_regiis.exe command utility

Next Recommended Reading Range Data Annotation Attribute in MVC