首页 > 解决方案 > Cannot deploy ASP.NET MVC + React to Azure

问题描述

I spent almost a day to troubleshoot the problem and still have no result. Problem: I created a new ASP.NET MVC + React project, NET.core 3.0. When I deploy it to Azure, I got error:

HTTP Error 500.30 - ANCM In-Process Start Failure
Common solutions to 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 a debugger to the application process and inspect
For more information visit: https://go.microsoft.com/fwlink/?LinkID=2028265

However, when I create a new project ASP.NET MVC + React project, NET.core 2.2 and deploy it, everything works well. So, I believe, the problem is NET.core 3.0. Under Development tools -> Extensions, I installed:

ASP.NET Core 2.2 (x64) Runtime

ASP.NET Core 3.0 (x64) Runtime

ASP.NET Core 3.0 (x86) Runtime

ASP.NET Core Logging Integration

Also, I found that error in logs

Application startup exception: System.InvalidOperationException: Key type not specified.
   at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ConfigureSigningCredentials.LoadKey()
   at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ConfigureSigningCredentials.Configure(ApiAuthorizationOptions options)

.....
at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
   at ApplicationProcessingApp.Program.Main(String[] args) in C:\Users\Test\Source\Repos\Test\ApplicationProcessingApp\ApplicationProcessingApp\Program.cs:line 16

Program.cs:line 16

        public static void Main(string[] args)
        {
            CreateWebHostBuilder(args).Build().Run();
        }

Nothing works. I stuck there. I am asking help from the community. Any suggestions will be appreciated. Thank you!

UPDATE: I added that line to appsettings.json and error above was gone. Right now, my browser returns error 500.

"Key": {
      "Type": "Development"
    },

标签: c#asp.net-mvcreactjsazureasp.net-core

解决方案


So, answer was on the top. You have to edit you appsettings.json and make you IdentityServer like that

  "IdentityServer": {
    "Key": {
      "Type": "Development"
    },
    "Clients": {
      "ApplicationProcessingApp": {
        "Profile": "IdentityServerSPA"
      }
    }
  },

I added that part

 "Key": {
      "Type": "Development"
    }

推荐阅读