且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ASP.NET服务器迁移

更新时间:2023-02-16 22:45:57

 <&的System.Web GT;
    <的machineKey的validationKey =生成你自己的decryptionKey =验证=3DES/&GT在自己的生成;
< /system.web>

您是正确的,移动将全部无效授权饼干。我相信,除非你有ViewState的加密打开,视图状态将被罚款。

如果您添加的machineKey属性的话,那不要紧,网站托管,只要这台机器的关键是一样的,加密和解密将被罚款。此外,您将需要/应该使用这个,如果你的网站是在负载均衡的环境中举行。

msdn.microsoft.com/en-us/library/ms998288.aspx

We have a long-lived ASP.NET 3.5 application we are moving from a physical server running Windows 2005+IIS 6 to a virtual one running Windows 2008+IIS7. The new machine will assume the identify of the old one - IP's, DNS, etc.

Our clients keep our site up for hours - sometimes even days. My fear is that when we make this switch-over, suddenly all thier viewstates will fail to validate because the MachineKey will have changed.

Is this kind of disruption avoidable? Can I 'set' the new server's machineKey to be the same as the one in use now? I think it is autogenerated - can I find out what it is?

Or, is this even worth it - is this a suck-it-up situation where users shouldn't expect to be able to hit a website for that long?

<system.web>
    <machineKey validationKey="Generate on your own" decryptionKey="Generate on your own" validation="3DES"/>
</system.web>

You are correct, moving will invalidate all Authorization Cookies. I believe, unless you have viewstate encryption turned on, viewstate will be fine.

If you add the machinekey attribute, then it doesn't matter where the site is hosted, as long as that machine key is the same, encryption and decryption will be fine. Additionally, you will need to/should use this if your site is hosted in a load balanced environment.

msdn.microsoft.com/en-us/library/ms998288.aspx