c# - 获取错误 "The ' targetFramework' 属性当前引用的版本高于已安装的 .NET Framework 版本”

标签 c# .net asp.net-mvc iis asp.net-web-api

我已经在 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/

相关文章:

c# - 如何在 C# 中创建回调变量(真正的单播委托(delegate))

c# - mysql连接c#中出现异常

c# - 确保 Controller 有一个无参数的公共(public)构造函数

c# - C# 中的 Struct.Pack 等价物?

c# - 计算进度百分比

c# - 在 C# 中实现阻塞队列

c# - 组织方法以更好地访问它们

c# - ForEach 超过对象错误

c# - 服务器上的 HangFire 重复作业失败,并出现 Autofac.Core.Registration.ComponentNotRegisteredException 或无参数异常

asp.net-mvc - RazorPDF将pdf文件保存到MVC4中的服务器目录