出现错误“当前'targetFramework'属性引用的版本比.NET Framework的已安装版本晚". [英] Getting Error "The 'targetFramework' attribute currently references a version that is later than the installed version of the .NET Framework"
问题描述
我已经在IIS7服务器上发布了ASP.NET Web API.当我在本地测试时.我在下面看到一个框架错误:
I've published an ASP.NET Web API on IIS7 server. When I'm testing it locally. I get a framework error below:
配置错误
说明:在处理 服务此请求所需的配置文件.请查看 下面的特定错误详细信息并修改您的配置文件 适当地.
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.
解析器错误消息:
Web.config文件的<compilation>
元素仅用于定位
.NET Framework 4.0版和更高版本(例如,
'<compilation targetFramework="4.0">
'). "targetFramework"
属性当前引用的版本晚于
.NET Framework的已安装版本.指定有效的目标
.NET Framework版本,或安装所需版本的.NET Framework.
.NET Framework.
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.
源错误:
第20行:</appSettings>
第21行:<system.web>
第22行:<compilation targetFramework="4.5" />
第23行:<httpRuntime targetFramework="4.5" />
第24行:<authentication mode="None" />
Line 20: </appSettings>
Line 21: <system.web>
Line 22: <compilation targetFramework="4.5" />
Line 23: <httpRuntime targetFramework="4.5" />
Line 24: <authentication mode="None" />
我不太清楚这是怎么回事,因为我有一个使用Framework 4.0在服务器上运行的ASP.NET网站.
I'm not quite sure what it is wrong as I have an ASP.NET website running on the server using framework 4.0.
推荐答案
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
%windir%\Microsoft.NET\Framework\v4.0.30319
现在运行以下命令:
aspnet_regiis -iru
aspnet_regiis -iru
这篇关于出现错误“当前'targetFramework'属性引用的版本比.NET Framework的已安装版本晚".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!