【问题标题】:Was not able to deploy my asp.net MVC web application on asp.net version 4.0无法在 asp.net 4.0 版上部署我的 asp.net MVC Web 应用程序
【发布时间】:2014-03-05 13:24:02
【问题描述】:

在我的登台服务器中,我安装了 .net 4.5 版,并开发了我的 asp.net mvc Web 应用程序。

现在,当我在生产环境中部署应用程序时,它在 web.config 文件中引发了错误:-

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 63:     </caching>
Line 64:     <customErrors mode="RemoteOnly" />
Line 65:     <compilation targetFramework="4.5">
Line 66:       <assemblies>
Line 67:         <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 

Source File: C:\inetpub\wwwroot\web.config (file:///C:/inetpub/wwwroot/web.config)    Line: 65 



  _____  


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1 So 

我检查了生产中的 .net 版本,它是 4.0 而不是 4.5。

所以现在我将在生产服务器上执行以下操作:-

  1. 我将在生产环境中下载并安装 .net 4.5 版。
  2. 一夜之间重新启动生产服务器。

那么这会解决问题吗,还是我必须在 IIS 上重新部署整个 asp.net mvc 以使其采用新的 .net 版本?

【问题讨论】:

  • 可以,前提是您在部署应用程序时将应用程序池设置为使用 4.5 而不是 4.0
  • 所以我不想修改我的代码,所以我将在生产环境中安装 .nt 版本 4.5 以保持我的代码不变......
  • 那么在生产上安装 4.5 后它会工作吗?无需重新部署东西?
  • 是的,您可以安装 .NET Framework 4.5,您将重新启动计算机,但无需重新部署。您的代码已投入生产,您报告的问题并非基于您的代码。完成重新启动后,转到您的站点应用程序池并确保将目标框架更改为 4.5,这应该可以解决您的问题。
  • 但我认为我不需要更改应用程序池以使用 4.5 ...

标签: .net asp.net-mvc asp.net-mvc-4 iis


【解决方案1】:

您已经将站点部署到服务器(否则您不会看到该错误)所以是的,您需要做的就是在服务器上安装 .Net 4.5。尽管这是最安全的选择,但您甚至可能不需要重新启动它。

您无需检查应用程序池,因为 .Net 4.5 不是 .Net 的新版本,它仍然在 .Net 4.0 运行时运行,您不会在应用程序池设置中看到 .Net 4.5 选项。就像您看不到应用程序池的 .Net 3.0 或 3.5 设置一样,因为它们都是 .Net 2.0 运行时的扩展。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-01-20
    • 1970-01-01
    • 2011-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-31
    相关资源
    最近更新 更多