【发布时间】:2014-10-22 19:48:26
【问题描述】:
我在使用通过 Visual Studio 的身份和访问工具配置的 ADFS 2.0 和 MVC 4 应用程序(在 IIS 7.5 上运行的应用程序)的事件查看器中遇到以下异常
Exception type: CryptographicException
Exception message: Key not valid for use in specified state.
我无法重现该错误。它在我们的公共网站上间歇性发生,我通过事件查看器看到它。
尽管这是一个单一的服务器部署并且不涉及农场(除了 ADFS 有一个主服务器和一个代理服务器),只是为了它,我通过阅读这篇文章启用了网络农场 cookie http://www.cloudidentity.com/blog/2013/01/28/running-wif-based-apps-in-windows-azure-web-sites-4/
上面的异常消失了,但是这个异常现在以相同的间歇频率出现:
Exception type: CryptographicException
Exception message: Error occurred during a cryptographic operation.
事件查看器的堆栈跟踪中没有行号。此应用程序中的任何其他异常都会给出行号,而这个没有。如果我没有行号,如何找出导致此异常的代码段?就像我说的我无法重现它,所以没有使用调试,或者是吗?
编辑
我注意到 web.config 中的 keys 节点下有两个元素。我不需要一个吗?
<system.identityModel>
<identityConfiguration>
<issuerNameRegistry type="System.IdentityModel.Tokens.ValidatingIssuerNameRegistry, System.IdentityModel.Tokens.ValidatingIssuerNameRegistry">
<authority name="http://our-FS-server/adfs/services/trust">
<keys>
<add thumbprint="abcd" />
<add thumbprint="efgh" />
</keys>
</authority>
</issuerNameRegistry>
</identityConfiguration>
</system.identityModel>
【问题讨论】:
标签: c# asp.net-mvc cryptography adfs2.0