Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use scoped service with SoapCore version 1.1.0.50 #1085

Closed
marcmognol opened this issue Oct 3, 2024 · 3 comments
Closed

Cannot use scoped service with SoapCore version 1.1.0.50 #1085

marcmognol opened this issue Oct 3, 2024 · 3 comments

Comments

@marcmognol
Copy link

Issue

Since I've updated my project dependency SoapCore to version 1.1.0.50, SoapCore isn't able to resolve Scoped or Transient registered service.

Did I miss anything?

Thanks.

Workaround

If I rollback to version 1.1.0.49, everything is working well.

Logs

fail: SoapCore.SoapEndpointMiddleware[0]
      An error occurred processing the message
      System.InvalidOperationException: Cannot resolve scoped service 'Interfaces.IReportService' from root provider.
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.ValidateResolution(ServiceCallSite callSite, IServiceScope scope, IServiceScope rootScope)
         at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
         at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
         at SoapCore.SoapEndpointMiddleware`1.ProcessMessage(Message requestMessage, SoapMessageEncoder messageEncoder, IAsyncMessageFilter[] asyncMessageFilters, HttpContext httpContext, IServiceProvider serviceProvider) in /_/src/SoapCore/SoapEndpointMiddleware.cs:line 527
         at SoapCore.SoapEndpointMiddleware`1.ProcessOperation(HttpContext httpContext, IServiceProvider serviceProvider) in /_/src/SoapCore/SoapEndpointMiddleware.cs:line 328

In SoapEndpointMiddleware.cs file:

image

@andersjonsson
Copy link
Collaborator

Hopefully I've fixed this issue in #1086
I'll leave this open until you've had the chance to test and confirm

@marcmognol
Copy link
Author

Hi @andersjonsson ,

Thank you for your quick support on this. Yes it works better with your commit.

Marc

@andersjonsson
Copy link
Collaborator

Thank you for confirming!

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

No branches or pull requests

2 participants