2010-09-27 53 views
0

我们使用在IIS 6 SessionAuthenticationModule一个问题,尝试访问该应用程序时,以下异常occures:问题使用WIF与IIS6

数据保护操作不成功。这可能是因为没有为当前线程的用户上下文加载用户配置文件,这可能是线程模拟时的情况。

我已经能够解决的是有可能在IIS 7中启用配置文件,但我们的托管公司使用IIS 6. 任何想法该怎么办?要尝试的东西,还是只是一般的想法?

堆栈跟踪:

[CryptographicException: The data protection operation was unsuccessful. This may have been caused by not having the user profile loaded for the current thread's user context, which may be the case when the thread is impersonating.] 
    System.Security.Cryptography.ProtectedData.Protect(Byte[] userData, Byte[] optionalEntropy, DataProtectionScope scope) +456 
    Microsoft.IdentityModel.Web.ProtectedDataCookieTransform.Encode(Byte[] value) +54 

[InvalidOperationException: ID1074: A CryptographicException occurred when attempting to encrypt the cookie using the ProtectedData API (see inner exception for details). If you are using IIS 7.5, this could be due to the loadUserProfile setting on the Application Pool being set to false. ] 
    Microsoft.IdentityModel.Web.ProtectedDataCookieTransform.Encode(Byte[] value) +146 
    Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.ApplyTransforms(Byte[] cookie, Boolean outbound) +47 
    Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.WriteToken(XmlWriter writer, SecurityToken token) +470 
    Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.WriteToken(SessionSecurityToken sessionToken) +89 
    Microsoft.IdentityModel.Web.SessionAuthenticationModule.WriteSessionTokenToCookie(SessionSecurityToken sessionToken) +123 

回答

1

我有同样的问题与本地IIS7服务器和由loadUserProfile设置为true的应用程序池解决它。我发现以下关于IIS6:

使用IIS6,所有工作进程(无论配置了哪个进程标识)都用作C:\ windows \ temp作为临时目录。更具体地说,默认情况下,没有工作进程加载他们的'用户配置文件',导致它们全部使用c:\​​ windows \ temp作为临时目录。 Windows允许所有用户在此目录上读/写/创建者权限,这允许事情“正常工作”。这样做的负面影响是,所有的AppPools默认都有效地共享相同的临时目录,这可能会导致跨应用程序池信息泄露。 使用IIS7,我们选择了更安全的默认设置,并默认为所有应用程序池加载用户配置文件。

loadUserProfile and IIS7

所以它看起来像IIS6不应该被锁定下来默认的临时目录。我想知道您的主机是否出于同样的原因锁定了它。

+0

谢谢,会检查是否有可能。实际上我们结束了,因为我的应用程序由外部提供者托管,实现了使用机器密钥的替代令牌处理程序(因此不需要“用户配置文件”)。这不是最佳的解决方案,但作为一个暂时的解决方案。 – Kristoffer 2010-10-27 07:04:46

2

创建虚拟窗口服务并在您的Web服务上安装窗口服务,并将其登录帐户更改为与您的Web应用程序池帐户相同。该工作

0

我在我有一个有效帐户但从未使用该帐户登录过的服务器上发生此异常。用户在AD上,这就成为可能。除了以用户身份登录之外,我尝试了几乎所有的东西。我终于想到做到这一点,它像一个魅力。