2015-10-07 73 views
0

我们已经将Orchard部署到Azure网站。然而,当我们让我们创建,使OWIN OpenID的连接模块,我们正在这导致错误:Orchard CMS,OWIN,OpenID Connect和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.

它只有当我让我们的自定义验证模块发生,但它工作在当地罚款和我们的开发服务器上。该问题只发生在Azure中。

堆栈跟踪:

 
[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) +514 
    System.Security.Cryptography.DpapiDataProtector.ProviderProtect(Byte[] userData) +75 
    Microsoft.Owin.Security.DataHandler.SecureDataFormat`1.Protect(TData data) +93 
    Microsoft.Owin.Security.OpenIdConnect.d__c.MoveNext() +1342 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13877064 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61 
    Microsoft.Owin.Security.Infrastructure.d__b.MoveNext() +531 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13877064 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61 
    Microsoft.Owin.Security.Infrastructure.d__8.MoveNext() +631 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13877064 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61 
    Microsoft.Owin.Security.Infrastructure.d__5.MoveNext() +318 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13877064 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61 
    System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) +13877209 
    Microsoft.Owin.Security.Infrastructure.d__0.MoveNext() +1371 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13877064 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61 
    System.Runtime.CompilerServices.TaskAwaiter.GetResult() +28 
    Microsoft.Owin.Security.Infrastructure.d__0.MoveNext() +1107 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13877064 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61 
    Orchard.Mvc.Routes.d__7.MoveNext() in c:\Users\jphillips\code\ifb-blue-orchard\src\Orchard\Mvc\Routes\ShellRoute.cs:181 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13877064 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61 
    System.Web.TaskAsyncHelper.EndTask(IAsyncResult ar) +69 
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +611 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137 
+0

你看着这个SO问题/答案:http://stackoverflow.com/questions/23773651/the-data-protection-operation-was-unsuccessful-on-azure-using-owin-katana – t1nr2y

+1

可能重复[生成重置密码令牌在Azure网站中不起作用](http://stackoverflow.com/questions/23455579/generating-reset-password-token-does-not-work-in-azure-website) –

+0

这不是一个副本。我已经尝试过这些解决方案而没有任何不同的结果 – Jamie

回答

1

所以我想通了,使用这个Generating reset password token does not work in Azure Website的组合,并告诉OWIN使用该扩展方法使用自定义MachineKeyProtectionProvider类。

app.SetDataProtectionProvider(new MachineKeyProtectionProvider()); 

一旦我设定OWIN使用Azure中机键,一切都知道酷和它的作品开始。我也写了一个关于它的post