title: Storage scopes cannot be created when _AppStart is executing
body: <p>Using ASP.NET MVC 3.0 with Visual Studio 2010 (Pre-SP1 and with SP1) and ASP.NET Development server I get the error "<strong>Storage scopes cannot be created when _AppStart is executing.</strong>" every time I debug. When I wait a couple seconds and refresh the browser it works as expected.</p>
  
  <ul>
  <li>Does this happen to everyone?</li>
  <li>Is there a way to prevent it?</li>
  <li>Should I be concerned about this in production? (IIS 6/7 hosting)</li>
  </ul>
  
  <p>Related <a href="http://aspnet.codeplex.com/workitem/7828">work-item #7828 on codeplex</a> has no official responses.</p>
  
  <p>Full stack trace:</p>
  
  <pre><code>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.&lt;&gt;c__DisplayClassb.&lt;BeginProcessRequest&gt;b__5() +37
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass1.&lt;MakeVoidDelegate&gt;b__0() +21
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass8`1.&lt;BeginSynchronous&gt;b__7(IAsyncResult _) +12
     System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
     System.Web.Mvc.&lt;&gt;c__DisplayClasse.&lt;EndProcessRequest&gt;b__d() +50
     System.Web.Mvc.SecurityUtil.&lt;GetCallInAppTrustThunk&gt;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&amp; completedSynchronously) +184
  </code></pre>