2

When I run aspx code through web server I get the following exception. What should I do to fix it ?

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

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

Source Error:

Line 9: <system.web>

Line 10:<customErrors mode="Off"/>

Line 11: <compilation debug="true" targetFramework="4.5" />

Line 12:<httpRuntime targetFramework="4.5" />

Line 13: </system.web>

2

2 Answers 2

3

It is because of the below cases:

  1. Your Application pool may configured for the .net framework version 2.0.
  2. Or the framework 4.5 may not be installed on your server.

Make sure the framework is registered with the IIS.

Go to "Website" in IIS -> Start Options -> build tab – > Select Target Framework in combo box (.NET FrameWork 4.5)

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

Comments

1

There's no targetFramework attribute for the <httpRuntime> node. You should remove it from your web.config:

<system.web>
    <customErrors mode="Off"/>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime />
</system.web>

Also make sure that you have configured the IIS application pool to use the correct version of the .NET framework.

4 Comments

With local host all is fine. I bought server domain and host and I am getting this error there.
Maybe there's some transformation on your web.config which has been performed on the host and which is invalid. Or maybe your host doesn't support .NET 4.5. In all cases it is clear from the exception stacktrace that you have invalid web.config out there. How this happened is an issue that you should probably discuss with your hosting provider and not on StackOverflow.
I solved it should config to 4.0 from Plesk Control Panel. But with <httpRuntime /> it gives me exception. When I remove it all is fine. What is the point of httpRuntime ? What does <httpRuntime /> do ?
Wrong Darin, there definitely a targetFramework for httpRuntime: msdn.microsoft.com/en-us/library/…

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.