文章内容
2019/2/18 11:13:07,作 者: 黄兵
Unable to resolve service for type IEmailSender while attempting to activate RegisterModel
最近在使用Asp.net core Identity的时候报如下错误:
System.InvalidOperationException: Unable to resolve service for type 'QuickstartIdentityServer.Services.IEmailSender' while attempting to activate 'QuickstartIdentityServer.Quickstart.UI.AccountController'.
解决方案:
在ConfigureServices(IServiceCollection services)
删除services.AddDefaultTokenProviders()
,具体代码如下:
startup.cs
services.AddDefaultIdentity<IdentityUser>()
.AddEntityFrameworkStores<ApplicationDbContext>();
///.AddDefaultTokenProviders(); /// remove this line
参考资料:Unable to resolve service for type IEmailSender while attempting to activate RegisterModel
黄兵个人博客原创。
转载请注明出处:黄兵个人博客 - Unable to resolve service for type IEmailSender while attempting to activate RegisterModel
评论列表