後指定狀態下使用我創建了一個自定義STS登錄應用程序和記錄輸入/輸出功能都正常工作。但是,如果我以某用戶身份登錄並執行IISRESET,然後重新加載該頁面,則會出現以下錯誤。 (但如預期之後我清除cookies和登錄再次工作正常:))重點無效IISRESET
APPPOOL用戶爲STS應用是「A」,他從來沒有窗戶登錄到服務器的機器,其中STS部署應用程序(他位於管理員組中並可訪問加密證書)。
我試圖登錄一次,作爲「A」進入服務器(Windows登錄),然後突然之間解決了這個問題。
誰能告訴爲什麼卻沒有IISRESET後工作,並在登錄窗口一次工作後?在「/」應用
服務器錯誤。
密鑰無效的使用在指定狀態。
[CryptographicException:重點不適於在指定狀態下使用]
System.Security.Cryptography.ProtectedData.Unprotect(Byte[] encryptedData, Byte[] optionalEntropy, DataProtectionScope scope)
Microsoft.IdentityModel.Web.ProtectedDataCookieTransform.Decode(Byte[] encoded)
[InvalidOperationException: 1D1073: A CryptographicException occurred when attempting to decrypt the cookie using the ProtectedData API (see inner exception for details).
Microsoft.IdentityModel.Web.ProtectedDataCookieTransform.Decode(Byte[] encoded) +433
Microsoft.IdentityModel .Tokens.SessionSecurityTokenHandler.ApplyTransforms(Byte] cookie, Boolean outbound) +189
Microsoft. IdentityModel .Tokens. SessionSecurityTokenHandler. ReadToken(XmlReader reader, SecurityTokenResolver tokenResolver) +894
Microsoft. IdentityModel .Tokens. SessionSecurityTokenHandler. ReadToken(Byte]] token, SecurityTokenResolver tokenResolver) +118
Microsoft.IdentityModel.Web.SessionAuthenticationModule.ReadSessionTokenrrocCookie(Byte] sessionCookie) +363
Microsoft.IdentityModel.Web. SessionAuthenticationModule.TryReadSessionTokenFroaCookie(SessionSecurityToken& sessionToken) +124
Microsoft. IdentityModel .Web. SessionAuthenticationModule.OnAuthenticateRequest(Object sender, EventArgs eventArgs) +61
System.Web.SyncEventExecutionstep.System.Web.HttpApplication.IExecutionStep.Execute() +80
System. Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270
Version Information: Microsoft .NET Framework Version:4.D.30319; ASP NET Version:4.O.30319.272
是的,這是問題,因爲我發現了。我們通過使用基於證書的會話cookie加密和解密來修復它,因爲我們遇到了負載平衡服務器的問題。 – 2014-03-21 14:11:26
靜態無功_CookieTransforms =新ReadOnlyCollection( 新CookieTransform [] { 新DeflateCookieTransform(), 新RsaEncryptionCookieTransform(證書), 新RsaSignatureCookieTransform(證書) }); 公共CustomSessionSecurityTokenHandler() :基地(_CookieTransforms) { } –
2014-03-21 14:17:42
這也將工作 - 這是對WIF 3.5的通用解決方案。如果您在負載平衡的服務器上運行,我假設您已經爲該應用程序指定了一個機器密鑰。新的基於機器鍵的令牌處理程序可以爲您節省安裝證書的麻煩。 :) 真高興你做到了。 – klings 2014-03-28 20:03:41