【问题标题】:SessionStateProviderBase HttpContext is not availableSessionStateProviderBase HttpContext 不可用
【发布时间】:2014-12-22 19:57:55
【问题描述】:

当我在一个页面上向同一个控制器发送两个或多个 ajax 请求时,出现以下错误:

The request lifetime scope cannot be created because the HttpContext is not available.

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.InvalidOperationException: The request lifetime scope cannot be created because the HttpContext is not available.

Source Error:


Line 20:             get
Line 21:             {
Line 22:                 return DependencyResolver.Current.GetService<ISessionService>();
Line 23:             }
Line 24:         }

【问题讨论】:

标签: asp.net-mvc autofac


【解决方案1】:

您好,我知道 Autofac.MVC5 更改后问题已解决。 就我而言,问题是因为 SessionProvider 在第一次请求之前进行了初始化,我认为这就是问题所在。 目前代码工作正常。

【讨论】:

    猜你喜欢
    • 2012-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-25
    • 2014-12-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多