我已经在 IIS7 服务器上发布了一个 ASP.NET Web API。当我在本地测试它时。我收到以下框架错误:
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" />
我不太确定哪里出了问题,因为我有一个使用框架 4.0 在服务器上运行的 ASP.NET 网站。
最佳答案
从 here 下载 .NET 4.5 安装成功后运行命令提示符(以管理员身份)并定位到这个地址:
%windir%\Microsoft.NET\Framework\v4.0.30319
现在运行这个命令:
aspnet_regiis -iru
关于c# - 获取错误 "The ' targetFramework' 属性当前引用的版本高于已安装的 .NET Framework 版本”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13545986/