moh*_*imi 12 asp.net iis asp.net-core
在IIS上发布程序后,我们遇到了这个错误
HTTP Error 500.30 - ASP.NET Core app failed to start
Common solutions to this issue:
The app failed to start
The app started but then stopped
The app 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
Run Code Online (Sandbox Code Playgroud)
当我们检查 stdout 日志文件后,出现此错误
at Microsoft.Extensions.Configuration.FileConfigurationProvider.HandleException(ExceptionDispatchInfo info)
at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load()
at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at ArtanNet.Program.Main(String[] args) in C:\Users\Administrator\Desktop\ArtanNet\ArtanNet\Program.cs:line 16
Run Code Online (Sandbox Code Playgroud)
program.cs文件代码为:
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
Run Code Online (Sandbox Code Playgroud)
网络配置:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\ArtanNet.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: d6cea5f9-6e6d-4f03-b6e9-1d0fb599d508-->
Run Code Online (Sandbox Code Playgroud)
现在请帮助我们修复这个错误
小智 13
HTTP 错误 500.30 - ASP.NET Core 应用程序无法启动是一个非常通用的错误消息。
要获取更具体的异常消息,您必须设置 enable ASPNETCORE_DETAILEDERRORS。要在 Azure 门户中执行此操作,请按照以下步骤操作:
现在,当您打开应用程序时,将显示详细的异常,而不是通用 HTTP 错误 500.30 - ASP.NET Core 应用程序无法启动。
小智 10
您使用的是哪个核心版本?您使用什么托管模型?进程内还是进程外?您可以在 csproj 文件中检查 thios 。如果您使用 In of Process,请尝试将其更改为
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
Run Code Online (Sandbox Code Playgroud)