I am registering OwinContext in StructureMap:
container.Register(() => HttpContext.Current.GetOwinContext());
But I get the following error on AssertConfigurationIsValid:
No owin.Environment item was found in the context
I found a solution for SimpleInjector which is the following:
container.RegisterPerWebRequest(() => {
if (HttpContext.Current != null && HttpContext.Current.Items["owin.Environment"] == null && container.IsVerifying()) {
return new OwinContext();
}
return HttpContext.Current.GetOwinContext();
});
Can this be replicated with StructureMap 3? I can't find a container.IsVerifying in it ...