13

I am configuring this application Confirming the account and recovering passwords in ASP.NET Core 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?

TanvirArjel
  • 22,594
  • 10
  • 59
  • 91
César Desu
  • 165
  • 1
  • 1
  • 7
  • Possible duplicate of [Using .netcore 2.2 and using the \`In Process\` Hosting Model](https://stackoverflow.com/questions/53811569/using-netcore-2-2-and-using-the-in-process-hosting-model) – Henke Oct 11 '19 at 10:32

10 Answers10

13

I've had the 500.30 error due to the duplicate identity problem cited by TanvirArjel, but I also just encountered the error when my appsettings.json file had some bad JSON in it. Not sure if that would only occur if you're actually trying to use configuration values in Startup.

Bryan B
  • 670
  • 6
  • 15
11

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.

TanvirArjel
  • 22,594
  • 10
  • 59
  • 91
6

I had this error come up. It turned out the root was because the app I was working with used Azure Key Vault, and I was using the wrong identity to authenticate with Azure.

I had to go to Tools > Options > Azure Service Authentication and change the identity used for Azure service authentication.

enter image description here

Dan Schnau
  • 1,295
  • 13
  • 13
4

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

osynavets
  • 476
  • 4
  • 12
2

What solved this exact error for me (in .NET Core 2.2) on the production IIS server was disabling 32-bit application support in my application pool. Everything worked fine on my local Win10 IIS Express setup.

I published my application from Visual Studio 2019 (Publish > Settings tab) as "Deployment Mode: Framework dependent" and "Target Runtime: win-x64." I'm not sure if the former option matters or not.

To remedy the error on the IIS Server, I needed to go into "Advanced Settings" on my application pool and set "Enable 32-bit Applications" to "False." You can also do this at the global level if it makes sense to. You'll find the global "Advanced Settings" on the right in the "Actions" pane.

Sum None
  • 1,534
  • 2
  • 19
  • 28
1

I had the same issue when I had a web application and a web api site (from the same solution) using the same application pool. I resolved the issue when I created a new application pool for the web api so that it was no longer sharing the app pool with the web application.

CodeCaptain
  • 169
  • 2
  • 9
0

I got 500.30 when updating openiddict 2.0.0-rc2-final to openiddict 2.0.0

TanvirArjel's answer, pointed me to remove .AddOAuthValidation(); from StartUp.cs

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
}
ono2012
  • 4,457
  • 2
  • 30
  • 42
0

Add try catch block in program.cs may help to solve the issue

public static void Main(string[] args)
        {
            try { 
            CreateWebHostBuilder(args).Build().Run();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
        }
Tassadaque
  • 7,831
  • 12
  • 51
  • 86
-1

I received this problem after visual studio updating at version 16.4.1, I resolved it with changing a package reference in cs.proj:

from PackageReference Include="Microsoft.AspNetCore" Version="2.2.0"

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

enter image description here

Aleksey Potapov
  • 3,363
  • 4
  • 38
  • 61
iugs88
  • 156
  • 1
  • 7
-2

I just try to enable all the feature relate to ASP in the Windows features > Internet Information Services > World Wide Web Services > Application Development Features.

pjiaquan
  • 47
  • 1
  • 1