将 MachineKey 从旧服务器上的 iis6 迁移到新服务器上的 iis7
我正在将我们的托管环境迁移到一个全新的数据中心,配备新的盒子、硬件和软件……整个交易。
我们的网站 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您看过这个吗?
看起来您可以通过查看
检索它,但是它们是内部的,所以您'必须使用反射。
Have you seen this?
Looks like you can retrieve it by looking at
System.Web.Configuration.MachineKeySecion.DecryptionKeyInternal
andSystem.Web.Configuration.MachineKeySecion.ValidationKeyInternal
These are internal however, so you'll have to use reflection.
您可以使用两个机器密钥。我不确定您使用哪一种来加密。但无论如何,这里有两个机器密钥...
哈特哈,
拉胡尔
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...
HTH,
Rahul