将 MachineKey 从旧服务器上的 iis6 迁移到新服务器上的 iis7

发布于 2024-08-22 07:01:09 字数 847 浏览 7 评论 0原文

我正在将我们的托管环境迁移到一个全新的数据中心,配备新的盒子、硬件和软件……整个交易。

我们的网站 cookie 使用 machineKey 进行加密,因此当我向我的域发出请求并将其指向新的 Web 服务器(通过覆盖本地主机文件)时,我会收到错误,因为 cookie 无法解密,因为 Machine Key是不同的。我想避免频繁用户第一次到达新服务器时可能遇到的任何问题。

据我所知,此时我认为我需要在新服务器上设置与当前服务器相同的 MachineKey。这样,当过去的带有 cookie 的访问者到达由新服务器提供服务的我们的网站时,cookie 将使用加密的 MachineKey 正确解密,然后正确登录。

我的问题是在哪里可以找到我的 MachineKey 值(在 IIS 6 win2k3 服务器中),以便我可以使用该值在我的新服务器上静态设置它?我已经提取了 machine.config 文件,但它没有指定密钥,它只指定了可以定义密钥的 configSection 。它不在我的应用程序或其他地方的 web.config 中。

我确实找到了这篇很棒的文章< /a> 关于 MachineKey 和 Web Garden 的一些问题(这可以解释我在 machineKey 方面遇到的其他一些错误)。

更新 我回到这个问题,仍然面临着类似的问题。我在 IIS6 服务器上自动生成了 MachineKey,但我需要获取确切的密钥,以便我可以显式设置它,而不再自动生成它。

任何帮助表示赞赏...

I am migrating our hosting environment to a totally new data center with new boxes and hardware and software... the whole deal.

Our website cookies are encrypted using the machineKey, so when I make a request to my domain and point it to the new web server (by overriding the local hosts file), I get an error because the cookie cannot be decrypted, since the Machine Key is different. I'd like to avoid any problems a frequent user might have when they arrive at the new server for the first time.

To the best of my knowledge, at this point I think I need to set the same MachineKey from our current servers on our new servers. This way when past visitors with a cookie arrive at our website served by the new server, the cookie will be decrypted properly with the MachineKey it was encrypted with and then log them in properly.

My question is where do I find my MachineKey value (in IIS 6 win2k3 server) so I can use that value to set it statically on my new servers? I've pulled up my machine.config file, but it doesn't specify the key, it only specifies a configSection where the key can be defined. It's not in my web.config for the app or elsewhere.

I did find this great article on some MachineKey and Web Garden woes (which could explain some other bugs I've been experiencing with regard to the machineKey).

Update
I am back to this issue and am still faced with a similar problem. I have the MachineKey auto-generated on the IIS6 server but I need to get that exact key so I can set it explicitly and not have it auto-generated anymore.

Any help is appreciated...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

总攻大人 2024-08-29 07:01:09

您看过这个吗?

看起来您可以通过查看

  • System.Web.Configuration.MachineKeySecion.DecryptionKeyInternal 和
  • System.Web.Configuration.MachineKeySecion.ValidationKeyInternal 来

检索它,但是它们是内部的,所以您'必须使用反射。

Have you seen this?

Looks like you can retrieve it by looking at

  • System.Web.Configuration.MachineKeySecion.DecryptionKeyInternal and
  • System.Web.Configuration.MachineKeySecion.ValidationKeyInternal

These are internal however, so you'll have to use reflection.

み格子的夏天 2024-08-29 07:01:09

您可以使用两个机器密钥。我不确定您使用哪一种来加密。但无论如何,这里有两个机器密钥...

  1. C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys
  2. http://support.microsoft.com/kb/312906。您不应该将其保留为“自动生成”,否则机器密钥将在所有计算机上自动生成,因此,它会有所不同。

哈特哈,
拉胡尔

There are two machineKeys that you can use. I am not sure which one you are using to encrypt. But here are the two machinekeys anyways...

  1. C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys
  2. http://support.microsoft.com/kb/312906. You shouldn't keep it as AutoGenerate, else the machineKeys will be autogenerated on all the machines and hence, it would be different.

HTH,
Rahul

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文