© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
8 replies
.bobgoblin

❔ DI Question

I have this code for setting up DI in my worker service project https://pastebin.com/6HH5sBAx

But when I run my code I get this error
System.AggregateException: 'Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Microsoft.Extensions.Hosting.IHostedService Lifetime: Singleton ImplementationType: WorkerService1.Worker': A circular dependency was detected 
System.AggregateException: 'Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Microsoft.Extensions.Hosting.IHostedService Lifetime: Singleton ImplementationType: WorkerService1.Worker': A circular dependency was detected 


What have I set-up wrong?
Pastebin
codeu - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ ✅ AutoMapper DI
C#CC# / help
3y ago
DI and Views
C#CC# / help
13mo ago
❔ API DI advice
C#CC# / help
4y ago
❔ How DI works?
C#CC# / help
4y ago