2014-03-05 53 views
0

在我的登台服务器中我安装了.net版本4.5,并开发了我的asp.net mvc web应用程序。无法在asp.net版本4.0上部署我的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. 重新启动生产服务器过夜。

那么这将解决这个问题,或者我有重新部署我的整个asp.net mvc在IIS上它采取新的.net版本?

+1

是的,只要在部署应用程序时应用程序池设置为使用4.5而不是4.0 – Gjohn

+0

,所以我不想修改我的代码,所以我将在生产环境中安装.nt verison 4.5以使我的代码因为... –

+0

所以在安装4.5版本之后它会工作吗?而不需要重新部署一个东西? –

回答

3

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

您不需要检查应用程序池,因为.Net 4.5不是新版本的.Net,它仍然运行在.Net 4.0运行时,并且在应用程序池设置中不会看到.Net 4.5选项。与您没有看到.Net 3.0或3.5应用程序池设置相同,因为它们都是.Net 2.0运行时的扩展。