c # – Error declaring Scoped service not registered but saved.

I'm trying to call a limited service inside an IHostedService to run a background task that interacts with the database. Basically, he tells me that my Scoped service is not a registered service.

This is the line I use to register the service from Startup.cs


This is the implementation of this service in my hosted service

using (var scope = _serviceScopeFactory.CreateScope ())
var scopedIdeaService = scope.ServiceProvider.GetRequiredService();

foreach (var idea in ideaList.Ideas)
var exists = wait scopedIdeaService.GetIdeaByIdAsync (idea.IdeaId);

var updatedIdea = AddIdeaDataForDatabase (idea, exists);

if (exists == null)
wait scopedIdeaService.CreateIdeaAsync (wait updatedIdea);
wait scopedIdeaService.UpdateIdeaAsync (wait updatedIdea);

The exact error I receive is:

HResult = 0x80131509
Message = No service for type BrightIdeaService.Services.BrightIdea.IdeaService & # 39; has been registered.
Source = Microsoft.Extensions.DependencyInjection.Abstractions
Trace of the pile:
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService (IServiceProvider Provider, type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
on BrightIdeaService.Services.BrightIdea.BrightIdeaReportingDownload.d__6.MoveNext ()

I'm trying to figure out if my service record is incorrect or if I'm declaring the scope incorrectly. It's quite possible that I do not know what I'm doing too. Suggestions would be appreciated.