karuna
karuna

Reputation: 83

Issue in LightInject when getting service instance

I have integrated Light Inject in web api project. I am able to register service successfully in application_start in global.asax. I am using filter which needs to be registered as well in application_start in global.asax. Filter constructor have reference to the services registered however I am not able to get the service instance. Samplee code: service registration is as below:

container.Register<ILogger, EPPSLogger>(GetLifetime());

filter registration needs instance of ILogger. Using below code:

config.Filters.Add(new EPPSAuthenticationFilter(
config.DependencyResolver.GetService<ILogger>(),
config.DependencyResolver.GetService<IAuthenticationSecrets>()));

gets the error when try to getService that lightinject module is not injected/registered. I cant upgrade to .net framework 4.5 or so.

Any help is highly appreciated. Thanks

Upvotes: 1

Views: 129

Answers (0)

Related Questions