【发布时间】: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: }
【问题讨论】:
-
这个不一样,我没用WebApi。
-
是一样的。 WebApi 和 MVC 都在 ASP.NET 管道中运行。 HttpContext 是一样的。
标签: asp.net-mvc autofac