【问题标题】:Orchard CMS, OWIN, OpenID Connect, and Azure WebsiteOrchard CMS、OWIN、OpenID Connect 和 Azure 网站
【发布时间】:2016-01-05 02:22:58
【问题描述】:

我们已将 Orchard 部署到 Azure 网站。但是,当我们启用我们创建的启用 OWIN OpenID 连接的模块时,我们会收到以下错误:

数据保护操作不成功。这可能是由于 通过不为当前线程的用户加载用户配置文件 上下文,可能是线程模拟时的情况。

仅当我启用我们的自定义身份验证模块时才会发生这种情况,但它在本地和我们的开发服务器上运行良好。该问题仅发生在 Azure 中。

堆栈跟踪:

[CryptographicException:数据保护操作不成功。这可能是由于没有为当前线程的用户上下文加载用户配置文件,这可能是线程模拟时的情况。] System.Security.Cryptography.ProtectedData.Protect(Byte[] userData, Byte[] optionalEntropy, DataProtectionScope 范围) +514 System.Security.Cryptography.DpapiDataProtector.ProviderProtect(Byte[] userData) +75 Microsoft.Owin.Security.DataHandler.SecureDataFormat`1.Protect(TData 数据)+93 Microsoft.Owin.Security.OpenIdConnect.d__c.MoveNext() +1342 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+13877064 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+61 Microsoft.Owin.Security.Infrastructure.d__b.MoveNext() +531 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+13877064 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+61 Microsoft.Owin.Security.Infrastructure.d__8.MoveNext() +631 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+13877064 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+61 Microsoft.Owin.Security.Infrastructure.d__5.MoveNext() +318 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+13877064 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+61 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(任务任务)+13877209 Microsoft.Owin.Security.Infrastructure.d__0.MoveNext() +1371 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+13877064 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+61 System.Runtime.CompilerServices.TaskAwaiter.GetResult() +28 Microsoft.Owin.Security.Infrastructure.d__0.MoveNext() +1107 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+13877064 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+61 c:\Users\jphillips\code\ifb-blue-orchard\src\Orchard\Mvc\Routes\ShellRoute.cs:181 中的 Orchard.Mvc.Routes.d__7.MoveNext() System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+13877064 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+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

【问题讨论】:

标签: c# azure orchardcms owin


【解决方案1】:

所以我想出了结合使用 Generating reset password token does not work in Azure Website 并告诉 OWIN 使用自定义 MachineKeyProtectionProvider 使用此扩展方法的类。

app.SetDataProtectionProvider(new MachineKeyProtectionProvider());

一旦我设置 OWIN 开始使用机器密钥,Azure 中的一切都知道很酷并且可以正常工作。我还为此写了post

【讨论】:

    猜你喜欢
    • 2016-01-26
    • 2020-07-25
    • 2016-12-18
    • 2021-01-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多