2010-09-27 65 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上,這就成爲可能。除了以用戶身份登錄之外,我嘗試了幾乎所有的東西。我終於想到做到這一點,它像一個魅力。