Question: I am configuring this application
[Confirming the account and recovering passwords in ASP.NET Core](https://learn.microsoft.com/es-es/aspnet/core/security/authentication/accconfirm?view=aspnetcore-2.2&tabs=visual-studio)
but I have an error:

> 
> 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
> 
> 
> 

Below is my configuration:

```
[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>();
            });
        }
    }
}

```

Any idea what is the problem?

Answer: 
I got the reason. May be you are registering `Identity` twice in your application as follows:

One in `ConfigureServices` method of the startup class:

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

```

And other in the `IdentityHostingStartup` : 

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

```

**Register `Identity` just in one place i.e either in `ConfigureServices` method or in `IdentityHostingStartup`.**

Hope this will help you.
If you have no idea what the reason of that behavior, you can enable logging in the web.config file

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

```

and then in the logs folder you will find the detailed description of your exception