© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
32 replies
hutonahill

✅ unregistered services

I am implementing my own version of MapIdentityAPI<>() to add some custom functionality. to do this I've copied the code for the method and dependencies out of Microsoft.AspNetCore.Routing into a separate class from where i can call this CustomMapIdentityAPI<>().

i have finally purged all the errors and I've gotten to testing, but now i am getting this error:
System.InvalidOperationException: No service for type 'Microsoft.AspNetCore.Identity.IEmailSender1[Microsoft.AspNetCore.Identity.IdentityUser]' has been registered.
System.InvalidOperationException: No service for type 'Microsoft.AspNetCore.Identity.IEmailSender1[Microsoft.AspNetCore.Identity.IdentityUser]' has been registered.


pointing at this line:
var emailSender = endpoints.ServiceProvider.GetRequiredService<IEmailSender<TUser>>();
var emailSender = endpoints.ServiceProvider.GetRequiredService<IEmailSender<TUser>>();


I've tried reverting to the old version of MapIdentityApi<>() but i get the same error, so i assume its not something I've changed on accident. This leads me to conclude that my set up is flawed. i did just change my Main to be
async Task<int> Main
async Task<int> Main
instead of
int Main
int Main
, is this it? if so, how do i seed my roles without async methods?
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

❔ Services communication in Windows Services
C#CC# / help
3y ago
Blazor Services
C#CC# / help
3y ago
❔ Some services
C#CC# / help
3y ago
✅ hosting services
C#CC# / help
3y ago