When running an ASP.NET website, you may encounter the following error:

Configuration Error: The 'targetFramework' attribute is not recognized

This usually occurs when the website is targeting ASP.NET 4.0, but the application pool in IIS is configured to use ASP.NET 2.0.

To resolve this, you must ensure that:

  • The correct Application Pool is set to ASP.NET 4.0.
  • ASP.NET 4.0 is properly registered with IIS.

Step 1: Log in to IIS Manager

Log in to your Windows VPS/Server. Open Start → Administrative Tools → IIS Manager.

Expand the Sites folder from the left-side panel.

Step 2: Change Application Pool for the Website

Select the website that is facing the 'targetFramework' error. Right-click the website and select:

Manage Website → Advanced Settings.

Locate the Application Pool option. Change the value to ASP.NET 4.0. Click OK to save changes.

Alternative Way – Modify Dedicated Application Pool

In IIS Manager, click on Application Pools from the left-side panel. Select the dedicated application pool assigned to your website.

Right-click and choose Basic Settings. Under .NET Framework Version, select v4.0.xxxxx.

Click OK to apply the changes.

Note: If you are having a control panel, then we recommend that you change the application pool from there.

By updating the application pool to ASP.NET 4.0 and ensuring it is properly registered with IIS, you can resolve the 'targetFramework' configuration error and run your ASP.NET website smoothly.

Was this answer helpful? 4 Users Found This Useful (74 Votes)