c# - 无法将 ASP.NET MVC + React 部署到 Azure

标签 c# asp.net-mvc reactjs azure asp.net-core

我花了将近一天的时间来排查问题,仍然没有结果。 问题:我创建了一个新的 ASP.NET MVC + React 项目 NET.core 3.0。当我将其部署到 Azure 时,出现错误:

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

但是,当我创建一个新项目 ASP.NET MVC + React 项目 NET.core 2.2 并部署它时,一切正常。所以,我相信,问题出在 NET.core 3.0 上。 在“开发工具”->“扩展”下,我安装了:

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

此外,我在日志中发现了该错误

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:第 16 行

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

没有任何效果。我被困在那里。我正在向社区寻求帮助。任何建议将不胜感激。 谢谢!

更新: 我将该行添加到 appsettings.json 中,上面的错误消失了。现在,我的浏览器返回错误 500。

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

最佳答案

所以,答案在最上面。 你必须编辑你的appsettings.json并使你的IdentityServer像那样

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

我添加了该部分

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

关于c# - 无法将 ASP.NET MVC + React 部署到 Azure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58785842/

相关文章:

c# - 如何填充数据表中的每一列

c# - 在 EntityFramework 和 SQL Anywhere 作为提供者中使用字符串作为 PK 更新实体

javascript - 从 JSON 加载数据表时出错

javascript - 在哪里最好用 Redux 应用程序初始化 React?

c# - 在运行时停止/启动 WCF MEX 服务

c# - WPF 应用程序 list 文件

asp.net-mvc - ASP.NET MVC - 如何处理过期的密码?

c# - Scaffold-DbContext 无法构建,如何在 Nuget 控制台上解决此问题?

html - React.Js/ typescript : How can I pass colors through props?

javascript - 如何导入用户/用户集合?