Skip to content
This repository has been archived by the owner on Mar 2, 2023. It is now read-only.

Run-time error if specify PerRequestLifetimeManager #20

Open
geetmenon opened this issue Aug 2, 2021 · 0 comments
Open

Run-time error if specify PerRequestLifetimeManager #20

geetmenon opened this issue Aug 2, 2021 · 0 comments

Comments

@geetmenon
Copy link

We get the following runtime error on startup if we specify PerRequestLifetimeManager when registering types using Unity-MVC 5.11.1 (note: we do not have a direct reference to System.Web in our project):

TypeLoadException: Could not load type 'System.Web.IHttpModule' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Unity.AspNet.Mvc.PerRequestLifetimeManager.GetValue(ILifetimeContainer container)
Unity.Strategies.LifetimeStrategy.PreBuildUp(ref BuilderContext context)
Unity.UnityContainer+<>c.<.ctor>b__41_4(BuilderStrategy[] chain, ref BuilderContext context)
Unity.Builder.BuilderContext.Resolve(Type type, string name, InternalRegistration registration)
Unity.Builder.BuilderContext.Resolve(Type type, string name)
Unity.Builder.BuilderContext.Resolve(ParameterInfo parameter, object value)
lambda_method38(Closure , ref BuilderContext )
Unity.Strategies.BuildPlanStrategy.PreBuildUp(ref BuilderContext context)
Unity.UnityContainer+<>c.<.ctor>b__41_3(ref BuilderContext context)
Unity.UnityContainer.Unity.IUnityContainer.Resolve(Type type, string name, ResolverOverride[] overrides)
Microsoft.AspNetCore.Mvc.Controllers.ServiceBasedControllerActivator.Create(ControllerContext actionContext)
Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider+<>c__DisplayClass5_0.g__CreateController|0(ControllerContext controllerContext)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeNextResourceFilter()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant