1

In my app start I have the following code to register my module.

Conversation.UpdateContainer(builder =>
            {
                builder.RegisterModule<MyModule>();
            });

And I am using InstrumentedLUIS which has the following code.

   var builder = new ContainerBuilder();

   builder.Register(c => new BotFrameworkApplicationInsightsInstrumentation(CreateBasicSettings()))
            .Keyed<IBotFrameworkInstrumentation>(InstrumentationType.Basic)
            .SingleInstance();

   builder.Register(c => new BotFrameworkApplicationInsightsInstrumentation(CreateSettingsWithCognitiveServices()))
            .Keyed<IBotFrameworkInstrumentation>(InstrumentationType.Cognitive)
            .SingleInstance();

   _container = builder.Build();

Because of the above code my module register is getting lost and every subsequent call to bot I am getting, the requested service is not register please use optional.

Since I am not aware of the latest Autofac, can any one please guide me?

Vinit
  • 2,540
  • 1
  • 15
  • 22

1 Answers1

0

Add DependencyResolver.SetResolver(new AutofacDependencyResolver(container)); after _container = builder.Build(); although this is only one step to solve your issue I recommend you to read this per-request lifetime scope