Search This Blog

Loading...

Dec 20, 2012

Storage scopes cannot be created when _AppStart is executing


Sponsored Links:

This is a very common error while working on Razor application very first time.

To fix this issue add the reference of

using System.Web.WebPages.Scope;
using System.Reflection;

and then add the below event in Global.asax

protected void Application_BeginRequest()
{
var ob = typeof(
AspNetRequestScopeStorageProvider).Assembly.GetType(
"System.Web.WebPages.WebPageHttpModule").GetProperty
("AppStartExecuteCompleted",
BindingFlags.NonPublic | BindingFlags.Static);
ob.SetValue(null, true, null);
}

Follow by Email