4

在努力将 virto commerce 成功部署到 Azure 并为新用户激活电子邮件确认后,我一直遇到加密异常:

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.

at System.Security.Cryptography.ProtectedData.Protect(Byte[] userData, Byte[] optionalEntropy, DataProtectionScope scope)
   at VirtoCommerce.Web.Client.Providers.CookieTempDataProvider.Protect(Byte[] data) in c:\Users\Tiago\Documents\xpmarketplace\src\Extensions\Client\CommerceWebClient\Providers\CookieTempDataProvider.cs:line 91
   at VirtoCommerce.Web.Client.Providers.CookieTempDataProvider.SaveTempData(ControllerContext controllerContext, IDictionary`2 values) in c:\Users\Tiago\Documents\xpmarketplace\src\Extensions\Client\CommerceWebClient\Providers\CookieTempDataProvider.cs:line 28
   at System.Web.Mvc.TempDataDictionary.Save(ControllerContext controllerContext, ITempDataProvider tempDataProvider)
   at System.Web.Mvc.Controller.PossiblySaveTempData()
   at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
   at System.Web.HttpApplication.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar)

在谷歌搜索异常文本后,我遇到了一些指南,提示我应该在 IIS AppPool 中将 Load User Profile 设置为 True,我尝试这样做只是为了发现它默认情况下已经是 true。

这是来源之一https://social.msdn.microsoft.com/Forums/vstudio/en-US/ad1f7367-7727-4b1a-a190-840ff4ed5709/adfs-20-sso-the-data-protection-operation- was-unsuccessful?forum=日内瓦

编辑:系统生成任何令牌(帐户激活,重置密码)时引发异常。

4

1 回答 1

2

更新了 CookieTempDataProvider 类,它使用 MachineKey 而不是 ProtectedData 来加密和解密 cookie。那应该可以解决问题。我将重建我们的测试和演示环境并检查它是否有效。但是您可以下载完整的源代码或只下载该类并重新编译。它应该可以解决您遇到的问题。

于 2015-03-24T16:18:50.100 回答