SoapCore icon indicating copy to clipboard operation
SoapCore copied to clipboard

Unable to resolve service

Open tomskarasha opened this issue 8 years ago • 2 comments

Hi! Another unpleasant issue faced unfortunately:

Unable to resolve service for type 'ISomeLogic' while attempting to activate 'MyUberService'.

In my service class constructor I want to resolve DI:

        private ISomeLogic _someLogic;
        public MyUberService(ISomeLogic someLogic)
        {
            _someLogic= someLogic;
        }

but when I call it, in middleware var serviceInstance = serviceProvider.GetService(_service.ServiceType); gives me that error. Looks like before it calls MyUberService it needs to resolve ISomeLogic! Maybe we could think about some option to pass/configure extra services to this serviceProvider from UseSoapEndpoint or something similar?

tomskarasha avatar Aug 14 '18 09:08 tomskarasha

https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-2.1 You should register implementation of interface ISomeLogic in ASP.NET Core DI container.

kotovaleksandr avatar Aug 14 '18 13:08 kotovaleksandr

Yes I had registered it but in wrong one. Sorry my unintentional mistake!

tomskarasha avatar Aug 14 '18 17:08 tomskarasha