HTTP错误500.30-ASP.NET Core 2.2中的ANCM进程内启动失败错误

Cés*_*esu 9 asp.net-core asp.net-core-identity asp.net-core-2.2

我正在配置此应用程序, 确认帐户并在ASP.NET Core中恢复密码, 但出现错误:

HTTP错误500.30-ANCM进程内启动失败导致此问题的常见原因:应用程序无法启动应用程序已启动但随后停止应用程序已启动但在启动过程中引发了异常故障排除步骤:检查系统事件日志中是否有错误消息启用日志记录功能应用程序进程的stdout消息将调试器附加到应用程序进程,并在IdentityHostingStartup中替换此代码时检查http 500

下面是我的配置:

[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>();
            });
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

知道是什么问题吗?

Tan*_*jel 10

我有原因。可能是您Identity在应用程序中进行了两次注册,如下所示:

ConfigureServices启动类的一种方法:

services.AddDefaultIdentity<IdentityUser>()
                .AddDefaultUI(UIFramework.Bootstrap4)
                .AddEntityFrameworkStores<ApplicationDbContext>();
Run Code Online (Sandbox Code Playgroud)

IdentityHostingStartup

services.AddDefaultIdentity<IdentityUser>(config =>
                {
                    config.SignIn.RequireConfirmedEmail = true;
                }).AddEntityFrameworkStores<ApplicationDbContext>();
Run Code Online (Sandbox Code Playgroud)

Identity仅在一个位置注册,即在ConfigureServices方法中或在中IdentityHostingStartup

希望这会帮助你。


Bry*_*n B 10

由于TanvirArjel引用的重复身份问题,我遇到了500.30错误,但是当我的appsettings.json文件中包含一些错误的JSON时,我也遇到了该错误。不知道是否仅在您实际上尝试在启动中使用配置值时才会发生。


Dan*_*nau 6

我出现了这个错误。原来是因为我使用的应用程序使用了 Azure Key Vault,而我使用错误的身份向 Azure 进行身份验证。

我必须转到“工具”>“选项”>“Azure 服务身份验证”并更改用于 Azure 服务身份验证的身份。

在此处输入图片说明