9
votes

I've published an ASP.NET Web API on IIS7 server. When I'm testing it locally. I get a framework error below:

Configuration Error

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: The 'targetFramework' attribute in the <compilation> element of the Web.config file is used only to target version 4.0 and later of the .NET Framework (for example, '<compilation targetFramework="4.0">'). 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.

Source Error:

Line 20: </appSettings>
Line 21: <system.web>
Line 22: <compilation targetFramework="4.5" />
Line 23: <httpRuntime targetFramework="4.5" />
Line 24: <authentication mode="None" />

I'm not quite sure what it is wrong as I have an ASP.NET website running on the server using framework 4.0.

3
The error is in plain English.. you need to install .NET 4.5 on the server where the website is running.Shadow Wizard Hates Omicron
@cloudviz A bit late, but feel free to accept the answer. It's good for questions to have an accepted answer, so people having the same issue won't need to look at comments. :)Nic

3 Answers

4
votes

Download .net 4.5 from here after successfully installation run command prompt(as administrator) and locate to this address :

%windir%\Microsoft.NET\Framework\v4.0.30319

now run this command:

aspnet_regiis -iru

0
votes

Or you can change your application framework from 4.5 to 4.0 You can do this by right clicking on project >> Properties >> Target Framework.

-1
votes

Specify a valid target version of the .NET Framework, or install the required version of the .NET Framework.

You need to install .NET 4.5 on the server where the website is running.