How to resolve Autofac InstancePerHttpRequest

后端 未结 2 758
眼角桃花
眼角桃花 2020-12-03 01:52

I have registered a component like this in my Global.asax.cs:

ContainerBuilder builder = new ContainerBuilder();
builder.RegisterControllers(Assembly.GetExec         


        
2条回答
  •  无人及你
    2020-12-03 02:34

    I'm doing this in WebForms:

    this.RoutingService = ((Global)HttpContext.Current.ApplicationInstance).ContainerProvider.RequestLifetime.Resolve();
    

提交回复
热议问题