When I first start debugging a project using IIS Express I get an ArgumentNullException in StructureMapDependencyScope.HttpContext, as System.Web.HttpContext.Current is null.
I'm not sure, but this might be because I'm trying to resolve dependencies in Application_Start for use in authorisation filters by calling DependencyResolver.Current.GetService<> - maybe this is too early for the HttpContext to exist?
In any case, it means that StructureMap is not created HTTP-scoped instances; I can end up with multiple instances of my DbContext, for example, despite the fact it should be HTTP-scoped.
When I first start debugging a project using IIS Express I get an
ArgumentNullExceptioninStructureMapDependencyScope.HttpContext, asSystem.Web.HttpContext.Currentis null.I'm not sure, but this might be because I'm trying to resolve dependencies in
Application_Startfor use in authorisation filters by callingDependencyResolver.Current.GetService<>- maybe this is too early for theHttpContextto exist?In any case, it means that StructureMap is not created HTTP-scoped instances; I can end up with multiple instances of my
DbContext, for example, despite the fact it should be HTTP-scoped.