我花了将近一天的时间来解决问题,但仍然没有结果。问题:我创建了一个新的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"
},
以下是针对此类问题的推荐计划:
禁用自定义错误,请按照以下步骤为ASP.NET Core禁用自定义错误……这类似于customerror mode=off
在Program.cs
文件中添加这两个文件
public static void Main(string [] args)
{
var host = new WebHostBuilder()
.CaptureStartupErrors(true)
.UseSetting("detailedErrors", "true")
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseApplicationInsights()
.Build()
host.Run();
}
如果尚未为应用程序启用详细错误,请按照以下步骤启用标准日志
在web.config文件中添加以下行
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\<project name>.dll" stdoutLogEnabled="true" stdoutLogFile="\\?\%home%\LogFiles\stdout" />
请找到以下链接供您参考:
HTTP Error 500.30 - ANCM In-Process Start Failure error in ASP.NET Core 2.2
您可以使用“捕获启动错误”和详细的“错误”键配置主机在启动过程中对错误的响应方式>
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/hosting#configuring-a-host
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/error-handling#startup-exception-handling
还可以使用Azure App Service日志记录https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging#appservice
请确保您正在支持的运行时上运行该应用程序。例如:.NET Core 1.0.0 RC2自2016年9月27日起停止支持。.NET Core 1.0.0 RC1自2016年7月16日起停止支持。
检查https://www.microsoft.com/net/core/support
希望有帮助。