简体   繁体   English

ASP.Net 4.0 网站能否在仅支持 ASP.Net 4.8 框架的新服务器上运行

[英]Will ASP.Net 4.0 website work on new server which supports only ASP.Net 4.8 framework

I have an old website which was developed on.Net Framework 4.0 and client wants to move this website to new server which supports.Net 4.8 Framework.我有一个在 .Net Framework 4.0 上开发的旧网站,客户想将该网站移动到支持 .Net 4.8 Framework 的新服务器。

I am afraid if website will work properly on.Net 4.8 framework as i am not sure if there is full backward compatibility.我担心网站是否能在 .Net 4.8 框架上正常工作,因为我不确定是否完全向后兼容。

Unfortunately i cant test it as i don't have access to new server.不幸的是我无法测试它,因为我无权访问新服务器。

My understanding is it should work and i should point framework to 4.8 in below line of cide in web.config <compilation debug="true" targetFramework="4.8" > i hope rest will work such as <add assembly="System.Web.Extensions.Design...... as all of them point to 4.0我的理解是它应该工作,我应该在 web.config <compilation debug="true" targetFramework="4.8" >我希望 rest 将工作,例如<add assembly="System.Web.Extensions.Design......因为它们都指向4.0

<compilation debug="true" targetFramework="4.5" >
  <assemblies>
    <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
    <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    <add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    <!--  assembly doesnt work on MochaHost
     <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add assembly="stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
     -->
    <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <add assembly="Microsoft.Office.Interop.Excel, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C" />
    <add assembly="Microsoft.Office.Interop.Word, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C" />
    <!---->
  </assemblies>
</compilation>

.NET 4.8 is an 'extension' on .NET 4.0. .NET 4.8 是 .NET 4.0 的“扩展”。 Microsoft tries it's best to be backwards compatible, you can check https://learn.microsoft.com/en-us/do.net/framework/migration-guide/runtime/4.0-4.8 for seeing what can break if you run your website (or any other program compiled in .NET 4.0) on the .NET 4.8 runtime. Microsoft 尝试最好向后兼容,您可以查看https://learn.microsoft.com/en-us/do.net/framework/migration-guide/runtime/4.0-4.8看看如果您运行.NET 4.8 运行时上的网站(或在 .NET 4.0 中编译的任何其他程序)。 Most breaking changes have a switch that you can return to the older behavior, see the link above.大多数重大更改都有一个开关,您可以使用它返回到旧的行为,请参阅上面的链接。

You don't even have to change the target framework in the config.您甚至不必更改配置中的目标框架。 Changing the <compilation targetFramework="4.8" > will cause the website to be compiled under 4.8 (if it hasn't been pre-compiled) on the first request, which has it's own set of changes that can be viewed on the page https://learn.microsoft.com/en-us/do.net/framework/migration-guide/retargeting/4.0-4.8 .更改<compilation targetFramework="4.8" >将导致网站在第一次请求时在 4.8 下编译(如果尚未预编译),它有自己的一组更改,可以在页面https上查看//learn.microsoft.com/en-us/do.net/framework/migration-guide/retargeting/4.0-4.8

In case of doubt, you can install IIS on a test computer or your local computer, configure the website and test before you release on the new server.如有疑问,可以在测试机或本地机上安装IIS,在新服务器上发布前配置网站和测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM