【问题标题】:Asp.net MCV4 framework issueAsp.net MCV4 框架问题
【发布时间】:2012-08-22 01:07:51
【问题描述】:

我使用 VS 2012 和 MVC4 创建了一个网站,它在我的本地主机上工作,但是当我发布并放置我的主机时它不起作用。 IIS 配置是相同的。但它给了我这个错误行:

这是错误;

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="Forms">

提前感谢您的建议

【问题讨论】:

  • 我不是这个特定主题的专家,但这真的是整个错误吗?
  • 您的服务器上是否安装了 .NET 4.5?
  • 我刚刚安装,它确实有效,感谢您的建议。

标签: c# asp.net asp.net-mvc-4


【解决方案1】:

您必须在 IIS 中将应用程序池更新为 .net 4.0。目前可能设置为 2.0。

【讨论】:

    【解决方案2】:

    很有可能 IIS 没有安装 4(或者如果它是该站点未指定使用它)。假设您正在运行 IIS7,请查看这篇文章:

    【讨论】:

      【解决方案3】:

      我在服务器上安装 nopCommerce 2.80 时遇到了类似的问题。 我使用 IIS7 网络。 4.0集成池。并且刚刚从 WebMatrix Products->Frameworks 部分安装了 .net 4.5。将需要重新启动。 然后它开始工作了。

      【讨论】:

        【解决方案4】:

        将此标记更改为 4.0:

        <compilation targetFramework="4.0" />
        

        并删除此标签:

        <httpRuntime targetFramework="4.5" />
        

        【讨论】:

        • 刚遇到同样的问题,发现httpRuntime 是阻塞的块。
        【解决方案5】:

        您只需在 IIS 7.5 服务器中将 .NET 框架升级到 4.5 版,然后使用 Microsoft Web 安装程序 搜索 .NET,然后安装 .NET 框架 4.5 版并且针对该版本的所有应用程序都可以运行

        【讨论】:

          【解决方案6】:

          您必须安装 .net framework 4.5 才能正常工作。 .net framework 4.0 无法识别“targetframework”属性。因此,在命令提示符下运行以下命令并检查是否安装在主机上的 .net 版本 4.5。如果没有,则安装 .net framework 4.5。它将正常工作。 在cmd上运行这个命令如下。

          wmic /namespace:\\root\cimv2 path win32_product where "name like '%%.NET%%'" get version
          

          【讨论】:

            【解决方案7】:

            运行这个:Microsoft .NET Framework Repair Tool

            • 如果您需要在与互联网隔离的服务器上运行,请确保在离线模式下运行。

            【讨论】:

              猜你喜欢
              • 1970-01-01
              • 2016-09-02
              • 2023-03-03
              • 2022-11-01
              • 2017-09-02
              • 2011-10-21
              • 1970-01-01
              • 1970-01-01
              相关资源
              最近更新 更多