在成功将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中将加载用户配置文件设置为True,我试图发现它默认情况下已经是真的.
编辑:系统生成任何令牌(帐户激活,重置密码)时抛出异常.
最佳答案 更新了CookieTempDataProvider类,它使用MachineKey而不是ProtectedData来加密和解密cookie.那应该解决这个问题.我将重建我们的测试和演示环境并检查它是否有效.但是您可以下载完整的源代码或只下载该类并重新编译.它应该解决你遇到的问题.