应用程序池回收时,计算机密钥会更改 [英] Machine Key changes when app pool is recycled

查看:231
本文介绍了应用程序池回收时,计算机密钥会更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MachineKey API来加密/解密ASP.NET应用程序中的一段信息。我正在使用

I am using MachineKey API to encrypt/decrypt a piece of information in an ASP.NET application. I am using

MachineKey.Encode(data,MachineKeyProtection.All)

MachineKey.Decode(data,MachineKeyProtection.All)

API的方法。启用加载用户配置文件时,在Windows 8和Windows Server 2012上一切正常。问题是由于某种原因,它无法在带有IIS 7.5 的Windows Server 2008 R2上重新启动应用程序池。

methods of API. Everything works great on Windows 8 and Windows Server 2012 when Load User Profile is enabled. The problem is for some reason it doesn't survive app pool restart on Windows Server 2008 R2 with IIS 7.5.

最初我觉得我需要在应用程序池上启用加载用户配置文件设置,但这不是'没有任何区别。知道我在这里可能缺少什么吗?

Initially I had impression that I will need to enable Load User Profile setting on Application Pool but that doesn't make any difference. Any idea what I could be missing here?

谢谢

推荐答案

可能是每次应用程序池回收时IIS都会生成一个新的机器密钥。尝试在web.config中设置静态机器密钥,如下所述: IIS 7提示#10您可以从IIS管理器生成机器密钥。如果没有明确设置静态机器密钥,您的加密/解密密钥就是一个移动目标。

It could be that a new machine key is being generated by IIS each time the Application Pool recycles. Try setting a static machine key in your web.config as described here: IIS 7 Tip #10 You can generate machine keys from the IIS manager. Without explicitly setting a static machine key, your encryption/decryption key is a moving target.

这篇关于应用程序池回收时,计算机密钥会更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆