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

HTTP Error 500.30 - ANCM In-Process Start Failure error in ASP.NET Core 2.2

我正在配置这个应用程序 Confirming the account and recovering passwords in ASP.NET Core 但我有一个错误:

HTTP Error 500.30 - ANCM In-Process Start Failure Common causes of this issue: The application failed to start The application started but then stopped The application started but threw an exception during startup Troubleshooting steps: Check the system event log for error messages Enable logging the application process' stdout messages Attach to debugger to the application process and inspect http 500 when replacing this code in IdentityHostingStartup

以下是我的配置:

[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 两次,如下所示:

启动方法ConfigureServices中的一个class:

services.AddDefaultIdentity<IdentityUser>()
                .AddDefaultUI(UIFramework.Bootstrap4)
                .AddEntityFrameworkStores<ApplicationDbContext>();

IdentityHostingStartup 中的其他人:

services.AddDefaultIdentity<IdentityUser>(config =>
                {
                    config.SignIn.RequireConfirmedEmail = true;
                }).AddEntityFrameworkStores<ApplicationDbContext>();

只在一个地方注册 Identity,即在 ConfigureServices 方法或 IdentityHostingStartup.

希望对您有所帮助。

由于 TanvirArjel 引用的重复身份问题,我遇到了 500.30 错误,但是当我的 appsettings.json 文件中有一些错误的 JSON 时,我也遇到了这个错误。不确定是否只有在您实际尝试在启动中使用配置值时才会发生这种情况。

我遇到了这个错误。结果发现 root 是因为我正在使用的应用程序使用了 Azure Key Vault,并且 I was using the wrong identity to authenticate with Azure.

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

在生产 IIS 服务器上为我(在 .NET Core 2.2 中)解决这个确切错误的是在我的应用程序池中禁用 32 位应用程序支持。在我的本地 Win10 IIS Express 设置上一切正常。

我从 Visual Studio 2019 年(“发布”>“设置”选项卡)将我的应用程序发布为 "Deployment Mode: Framework dependent" 和 "Target Runtime: win-x64." 我不确定前一个选项是否重要。

为了修复 IIS 服务器上的错误,我需要进入我的应用程序池中的 "Advanced Settings" 并将 "Enable 32-bit Applications" 设置为 "False." 您也可以在全局级别执行此操作如果有意义的话。您会在 "Actions" 窗格的右侧找到全局 "Advanced Settings"。

openiddict 2.0.0-rc2-final 更新为 openiddict 2.0.0

时我得到了 500.30

TanvirArjel 的 ,指示我从 StartUp.cs

中删除 .AddOAuthValidation();
public void ConfigureServices(IServiceCollection services)
{
    // updated openiddict
    services.AddOpenIddict()
            .AddCore(options => { /*removed for brevity*/ })
            .AddServer(options => { /*removed for brevity*/ })
            .AddValidation();

    services.AddAuthentication(options => { /*removed for brevity*/ })
            .AddCookie()
            .AddOAuthValidation(); // this line
}

program.cs 中添加 try catch 块可能有助于解决问题

public static void Main(string[] args)
        {
            try { 
            CreateWebHostBuilder(args).Build().Run();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
        }

当我有一个 Web 应用程序和一个 Web api 站点(来自相同的解决方案)使用相同的应用程序池时,我遇到了同样的问题。当我为 Web api 创建一个新的应用程序池时,我解决了这个问题,这样它就不再与 Web 应用程序共享应用程序池。

我在 visual studio 更新版本 16.4.1 后收到此问题,我通过更改 cs.proj 中的包引用解决了它:

来自 PackageReference Include="Microsoft.AspNetCore" Version="2.2.0"

PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0"

如果您不知道该行为的原因,您可以在 web.config 文件中启用日志记录

<aspNetCore processPath="dotnet" arguments=".\WMC.Web.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />

然后在日志文件夹中,您将找到异常的详细描述

我只是尝试在 Windows 功能 > Internet 信息服务 > 万维网服务 > 应用程序开发功能中启用与 ASP 相关的所有功能。