asp.net-mvc-3 – _AppStart正在执行时无法创建存储范围
|
使用ASP.NET MVC 3.0与Visual Studio 2010(SP1之前和SP1)和ASP.NET开发服务器我得到错误“_AppStart正在执行时无法创建存储范围”。每次我调试当我等待几秒钟,并刷新浏览器它按预期工作。 这是否发生在每个人身上? 相关work-item #7828 on codeplex没有正式的回复。 全堆栈跟踪: Server Error in '/' Application. -------------------------------------------------------------------------------- Storage scopes cannot be created when _AppStart is executing. 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: Storage scopes cannot be created when _AppStart is executing. 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. Stack Trace: [InvalidOperationException: Storage scopes cannot be created when _AppStart is executing.] System.Web.WebPages.Scope.AspNetRequestScopeStorageProvider.set_CurrentScope(IDictionary`2 value) +83361 System.Web.WebPages.Scope.ScopeStorage.CreateTransientScope(IDictionary`2 context) +95 System.Web.WebPages.Scope.ScopeStorage.CreateTransientScope() +76 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +84 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10 System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37 System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21 System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62 System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50 System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7 System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8862381 System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean& completedSynchronously) +184 解决方法虽然我不知道为什么会发生这种情况(我也不能重现这一点)我可能会有一些修复,你可以尝试。 WebPageHttpModule(在System.Web.WebPages中)应该设置为AppStartExecuteCompleted,但它不会,这就是为什么你得到一个异常(所有这些猜测工作是基于此)。所以…看看源代码我相信这个bug的根源是Web开发服务器和PreApplicationCode动态注册一个模块(WebPageHttpModule)的东西。模块init应该始终运行在应用程序开始,但由于某种原因我GUESS它没有。也许有人可以以某种方式测试它。 一些我想到的修复(再次,这是纯粹的猜测工作,因为我无法重现)。 1)尝试在WebConfig中静态注册WebPageHttpModule模块。更新我已经测试了这个,这不会抛出异常。但是,它注册了两个httpmodules。 2)根据对你链接的线程的评论,似乎这不会发生在IIS上,所以我试图运行在IIS Express(在VS 2010 SP1下)。 正如我之前所说,这只是猜测工作。模块不能运行可能有其他原因…如Web服务器未正确重新启动,包括PreApplicationCode中的一些问题,或者不将HttpModule中的s_appStartExecutedLock重置为false,或者与HttpContext.Items相关的内容可能还有导致模块不能运行… (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- asp.net下使用jquery 的ajax+WebService+json 实现无刷新取
- asp.net – “viewstate MAC的验证失败.如果这个应用程序由
- 如何将asp.net文本框滚动到底部
- asp.net-mvc-3 – Telerik Kendo ui网格显示html单元格而不
- asp.net – SQL Server 2005:事务死锁
- asp.net – 在Response.Redirect()之后调用Response.End()
- asp.net – 从两个表(join)获取数据,并使用linq返回结果
- asp.net-mvc – 如何使用MVC中的rout删除url中的控制器名称
- .net – 加密ApplicationServices ConnectionString
- asp.net – 帮助捕获StackOverflowException与WinDbg和ADPl
