Server Error in '/' Application.

No owin.Environment item was found in the context.

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: No owin.Environment item was found in the context.

Source Error:


Line 1:  @using Felleskjopet.Common.Web.Features.Common.GoogleTracking
Line 2:  @{
Line 3:      var provider = DependencyResolver.Current.GetService<IGoogleTrackingDataProvider>();
Line 4:      var dataLayer = provider?.GetGlobalDataLayer();
Line 5:  }

Source File: E:\Sites\Felleskjopet\felleskjopet.no\www\Features\Common\GoogleTracking\GlobalDataLayer.cshtml    Line: 3

Stack Trace:


[InvalidOperationException: No owin.Environment item was found in the context.]
   System.Web.HttpContextExtensions.GetOwinContext(HttpContext context) +100
   lambda_method(Closure , IBuildSession , IContext ) +193

[StructureMapBuildException: Failure while building 'Lambda: HttpContext.Current.GetOwinContext()', check the inner exception for details
1.) Lambda: HttpContext.Current.GetOwinContext()
2.) Instance of Microsoft.Owin.IOwinContext
3.) new CookieManager(*Default of IOwinContext*)
4.) Felleskjopet.Common.Web.Helpers.CookieManager
5.) Instance of Felleskjopet.Common.Web.Helpers.CookieManager
6.) new EntranceService(*Default of CookieManager*, *Default of HttpEnvironmentHelper*)
7.) MakingWaves.Commerce.Services.EntranceService
8.) Instance of MakingWaves.Commerce.Services.IEntranceService (MakingWaves.Commerce.Services.EntranceService)
9.) new GoogleTrackingDataProvider(*Default of ICurrentMarket*, *Default of IContentRouteHelper*, *Default of IContentTypeRepository*, *Default of IBreadcrumbsService*, *Default of IEntranceService*)
10.) MakingWaves.Commerce.Webshop.Features.EnhancedCommerce.GoogleTrackingDataProvider
11.) Instance of Felleskjopet.Common.Web.Features.Common.GoogleTracking.IGoogleTrackingDataProvider (MakingWaves.Commerce.Webshop.Features.EnhancedCommerce.GoogleTrackingDataProvider)
12.) Container.GetInstance(Felleskjopet.Common.Web.Features.Common.GoogleTracking.IGoogleTrackingDataProvider)
13.) Container.TryGetInstance(Felleskjopet.Common.Web.Features.Common.GoogleTracking.IGoogleTrackingDataProvider)
]
   lambda_method(Closure , IBuildSession , IContext ) +1425
   StructureMap.Building.BuildPlan.Build(IBuildSession session, IContext context) +145
   StructureMap.SessionCache.GetObject(Type pluginType, Instance instance, ILifecycle lifecycle) +217
   StructureMap.SessionCache.GetDefault(Type pluginType, IPipelineGraph pipelineGraph) +191
   StructureMap.Container.GetInstance(Type pluginType) +401
   StructureMap.Container.TryGetInstance(Type pluginType) +184
   System.Web.Mvc.DependencyResolverExtensions.GetService(IDependencyResolver resolver) +59
   ASP._Page_Features_Common_GoogleTracking_GlobalDataLayer_cshtml.Execute() in E:\Sites\Felleskjopet\felleskjopet.no\www\Features\Common\GoogleTracking\GlobalDataLayer.cshtml:3
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +252
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +148
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +122
   System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +136
   ASP._Page_Features_Layout__Site_cshtml.Execute() in E:\Sites\Felleskjopet\felleskjopet.no\www\Features\Layout\_Site.cshtml:54
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +252
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +148
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +122
   System.Web.WebPages.<>c__DisplayClass40_0.<RenderPageCore>b__0(TextWriter writer) +309
   System.Web.WebPages.WebPageBase.Write(HelperResult result) +108
   System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) +89
   System.Web.WebPages.WebPageBase.PopContext() +310
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +378
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +91
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +795
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +795
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +795
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +795
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +795
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +795
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +795
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +81
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +970
   System.Web.Mvc.Controller.ExecuteCore() +131
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +238
   Felleskjopet.Common.Web.Infrastructure.ErrorHandling.DefaultErrorHandler.HandleHtmlError(HttpContext context, Func`2 actionSelector) in C:\TeamCity\buildAgent\work\5c57d776cc73576a\src\Felleskjopet.Common.Web\Infrastructure\ErrorHandling\DefaultErrorHandler.cs:83

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +269
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +146
   System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +34
   System.Web.Util.ArglessEventHandlerProxy.Callback(Object sender, EventArgs e) +77
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +223
   System.Web.<>c__DisplayClass285_0.<ExecuteStepImpl>b__0() +40
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +155
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +94


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4700.0