1

I have the following error in my ASP.NET page. Parser Error Message:

The 'targetFramework' attribute in the element of the Web.config file is used only to target version 4.0 and later of the .NET Framework (for example, ''). The 'targetFramework' attribute currently references a version that is later than the installed version of the .NET Framework. Specify a valid target version of the .NET Framework, or install the required version of the .NET Framework.

I have already installed .NET version 4 on the computer but it still gives the above error. Any idea how to fix it?

3 Answers 3

3

If you're hosting the site on IIS, change the .net framework version on the application pool serving your site from X.0 version to 4.0.

How to change the framework version on app pool:

1 Open IIS Manager.

2 On the Connections pane, expand the server node and click Application Pools.

3 On the Application Pools page, select the application pool for which you want to specify a .NET Framework version, and then click Basic Settings in the Actions pane.

4 In the Edit Application Pool dialog box, in the .NET Framework version list, select the version that you want the application pool to use or select No Managed Code if the application uses only native code.

5 Click OK.

Sign up to request clarification or add additional context in comments.

3 Comments

Dear Friend Thank you for your advice I have already done that. I have changed the application pool to .net v4.0 but still it has the same problem. Please advice
@user2103335: What's the framework version of the application?
Dear friend, please see the config files: <?xml version="1.0"?> <!-- For more information on how to configure your ASP.NET application, please visit go.microsoft.com/fwlink/?LinkId=169433 --> <configuration> <system.web> <compilation debug="true" targetFramework="4.5"> <assemblies> <add assembly="MySql.Data, Version=6.6.4.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/> </assemblies> </compilation> <httpRuntime targetFramework="4.5"/> </system.web> </configuration>
1

According to the error message it seems there is an invalid value in the tagetFramework property in the web.config file.

There should be something like this where there is something else than 4.0. Change it to 4.0:

<compilation debug="true" targetFramework="4.0"/>

update:

I can be stupid, but after reading the message 3 times, it does say ". The 'targetFramework' attribute currently references a version that is later than the installed version of the .NET Framework."

Did you install .NET 4.5? I only see 4.0 in your question.

2 Comments

I have changed that and this is the result Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive. Line 11: </assemblies> Line 12: </compilation> Line 13: <httpRuntime targetFramework="4.0"/> Line 14: </system.web> Line 15: </configuration>
@user2103335: Do you need more help? If not, please close this question by marking it as answered.
0

Try to run the ASP.NET registration tool < http://msdn.microsoft.com/en-us/library/k6h9cz8h(v=vs.100).aspx>. Be sure to execute aspnet_regiis.exe - ir in the.NET 4 directory.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.