【问题标题】:Orchard signalr CryptographicException果园信号器 CryptographicException
【发布时间】:2024-01-05 06:14:01
【问题描述】:

我在 Windows Server 2008 上的 IIS 上部署了带有 SignalR 1.3.1 chat module 的 Orchard 出现此异常。它在调试环境中运行良好。

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.

 Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

 Exception Details: System.Security.Cryptography.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.

 Source Error: 

 An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

 [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.]
 Microsoft.Owin.Host.SystemWeb.Infrastructure.<>c__DisplayClass1.<GetRethrowWithNoStackLossDelegate>b__0(Exception ex) +42
Microsoft.Owin.Host.SystemWeb.CallContextAsyncResult.End(IAsyncResult result) +88
Orchard.Mvc.Routes.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) +42
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288

here描述了相同问题的解决方案,但我不知道如何将其应用于果园

提前致谢

【问题讨论】:

    标签: signalr orchardcms cryptographicexception


    【解决方案1】:

    模块有一个bug

    您可以通过在 Load(ContainerBuilder moduleBuilder) 方法行中添加到 CoreModule.cs 来解决此问题:

    moduleBuilder.RegisterType<MachineKeyProtectedData>()
      .As<IProtectedData>();
    

    【讨论】: