user2103335
user2103335

Reputation: 63

Parse Error in asp.net page

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?

Upvotes: 1

Views: 816

Answers (3)

Patrick Hofman
Patrick Hofman

Reputation: 157136

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.

Upvotes: 1

IliaJ
IliaJ

Reputation: 159

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.

Upvotes: 0

Claudio Redi
Claudio Redi

Reputation: 68440

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.

Upvotes: 3

Related Questions