C#C
C#2y ago
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.


pointing at this line:
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 instead of int Main, is this it? if so, how do i seed my roles without async methods?
Was this page helpful?