# Cannot resolve scoped service in my dev environment

**URL:** <https://forum.litium.com/t/cannot-resolve-scoped-service-in-my-dev-environment/3515>\
**Category:** Questions\
**Tags:** litium-8\
**Created:** [August 20, 2025, 6:37pm UTC](https://forum.litium.com/t/cannot-resolve-scoped-service-in-my-dev-environment/3515 "2025-08-20T18:37:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![krilin](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/krilin/32/175_2.png) [@krilin](https://forum.litium.com/u/krilin)\
**Post date:** [August 20, 2025, 6:37pm UTC](https://forum.litium.com/t/cannot-resolve-scoped-service-in-my-dev-environment/3515/1 "2025-08-20T18:37:47Z")

</div>

Hi!

From no where my development environment wont start.  
I get this exception:

```auto
fail: Litium.Application.Runtime.ApplicationStartupEngine[0]
      Boob.Integration.StateTransitions.SalesOrderEventListenerIntegration -> Cannot resolve scoped service 'Boob.Integration.Monthly.IMonthlyGiftCardService' from root provider.
System.InvalidOperationException: Cannot resolve scoped service 'Boob.Integration.Monthly.IMonthlyGiftCardService' from root provider.
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.ValidateResolution(ServiceCallSite callSite, IServiceScope scope, IServiceScope rootScope)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.OnResolve(ServiceCallSite callSite, IServiceScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorInfoEx.GetService(IServiceProvider serviceProvider, Int32 parameterIndex)
   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetServiceOrCreateInstance(IServiceProvider provider, Type type)
   at Litium.Application.Runtime.ApplicationStartupEngine.<>c __DisplayClass10_0.<<Start>b__ 4>d.MoveNext()

```

In the start up I got this:

```auto
services.AddScoped<IMonthlyGiftCardService, MonthlyGiftCardService>();

```

Same code deployed to Litium Cloud runs just perfect.  
I not sure what to do here, feels like I tried everything, any ideas?

/Kristoffer

Litium version: _8.23.1_

---

<div class="post-metadata">

**Author:** ![krilin](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/krilin/32/175_2.png) [@krilin](https://forum.litium.com/u/krilin)\
**Post date:** [August 21, 2025, 3:13pm UTC](https://forum.litium.com/t/cannot-resolve-scoped-service-in-my-dev-environment/3515/2 "2025-08-21T15:13:00Z")

</div>

Another error today:

fail: Litium.Application.Runtime.ApplicationStartupEngine[0]  
Boob.Integration.StateTransitions.SalesOrderEventListenerIntegration → Cannot resolve scoped service ‘Boob.Integration.Monthly.IMonthlyGiftCardService’ from root provider.  
System.InvalidOperationException: Cannot resolve scoped service ‘Boob.Integration.Monthly.IMonthlyGiftCardService’ from root provider.  
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.ValidateResolution(ServiceCallSite callSite, IServiceScope scope, IServiceScope rootScope)  
at Microsoft.Extensions.DependencyInjection.ServiceProvider.OnResolve(ServiceCallSite callSite, IServiceScope scope)  
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)  
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)  
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorInfoEx.GetService(IServiceProvider serviceProvider, Int32 parameterIndex)  
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)  
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object parameters)  
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetServiceOrCreateInstance(IServiceProvider provider, Type type)  
at Litium.Application.Runtime.ApplicationStartupEngine.\<\>c\_\_DisplayClass10\_0.\<b\_\_4\>d.MoveNext()  
fail: Microsoft.Extensions.Hosting.Internal.Host[11]  
Hosting failed to start  
System.Net.Sockets.SocketException (10013): Ett försök gjordes att få åtkomst till en socket på ett sätt som är förbjudet av åtkomstbehörigheterna.  
at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)  
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)  
at System.Net.Sockets.Socket.Bind(EndPoint localEP)  
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportOptions.CreateDefaultBoundListenSocket(EndPoint endpoint)  
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketConnectionListener.Bind()  
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportFactory.BindAsync(EndPoint endpoint, CancellationToken cancellationToken)  
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure.TransportManager.BindAsync(EndPoint endPoint, ConnectionDelegate connectionDelegate, EndpointConfig endpointConfig, CancellationToken cancellationToken)  
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.\<\>c\_\_DisplayClass28\_0`1.<<StartAsync>g__OnBind|0>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions endpoint, AddressBindContext context, CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions.BindAsync(AddressBindContext context, CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.AnyIPListenOptions.BindAsync(AddressBindContext context, CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext context, CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)  
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)  
at Microsoft.Extensions.Hosting.Internal.Host.b\_\_14\_1(IHostedService service, CancellationToken token)  
at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)  
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)

---

<div class="post-metadata">

**Author:** ![Martin.Brandt](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/martin.brandt/32/974_2.png) [@Martin.Brandt](https://forum.litium.com/u/Martin.Brandt)\
**Post date:** [August 24, 2025, 4:45pm UTC](https://forum.litium.com/t/cannot-resolve-scoped-service-in-my-dev-environment/3515/3 "2025-08-24T16:45:18Z")

</div>

If SalesOrderEventListenerIntegration is registered as a singleton, and you are trying to use a scoped service inside that.. you will get an error, not sure if its THIS error, but that could perhaps be the case?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [September 21, 2025, 4:46pm UTC](https://forum.litium.com/t/cannot-resolve-scoped-service-in-my-dev-environment/3515/4 "2025-09-21T16:46:06Z")

</div>

Closed on September 21, 2025, 4:46pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
