本文介绍了HTTP错误500.30-ASP.NET Core 2.2中的ANCM进程内启动失败错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在配置此应用程序确认帐户并在ASP.NET Core中恢复密码但我有一个错误:
I am configuring this applicationConfirming the account and recovering passwords in ASP.NET Corebut I have an error:
下面是我的配置:
[assembly: HostingStartup(typeof(Misioneros.Stella.Maris.Web.Areas.Identity.IdentityHostingStartup))]
namespace Misioneros.Stella.Maris.Web.Areas.Identity
{
public class IdentityHostingStartup : IHostingStartup
{
public void Configure(IWebHostBuilder builder)
{
builder.ConfigureServices((context, services) => {
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(
context.Configuration.GetConnectionString("DefaultConnection")));
services.AddDefaultIdentity<IdentityUser>(config =>
{
config.SignIn.RequireConfirmedEmail = true;
})
.AddEntityFrameworkStores<ApplicationDbContext>();
});
}
}
}
有什么问题吗?
推荐答案
我明白了原因.可能是您在应用程序中两次注册了Identity
,如下所示:
I got the reason. May be you are registering Identity
twice in your application as follows:
启动类的ConfigureServices
方法之一:
services.AddDefaultIdentity<IdentityUser>()
.AddDefaultUI(UIFramework.Bootstrap4)
.AddEntityFrameworkStores<ApplicationDbContext>();
以及IdentityHostingStartup
中的其他内容:
services.AddDefaultIdentity<IdentityUser>(config =>
{
config.SignIn.RequireConfirmedEmail = true;
}).AddEntityFrameworkStores<ApplicationDbContext>();
将Identity
注册在一个位置,即使用ConfigureServices
方法还是IdentityHostingStartup
.
Register Identity
just in one place i.e either in ConfigureServices
method or in IdentityHostingStartup
.
希望这会对您有所帮助.
Hope this will help you.
这篇关于HTTP错误500.30-ASP.NET Core 2.2中的ANCM进程内启动失败错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!