我在发布我的应用到IIS后,当我尝试访问它时出现错误:
HTTP错误503. 服务不可用。
接下来我该怎么办?
我使用的是安装了以下软件的 Windows Server 2008 (64-bit) 和 IIS 8.5,应用是 web api .NET CORE 2.2.1:
- Microsoft .NET CORE 2.2.1 - Windows Server Hosting
- Microsoft .NET CORE Runtime - 2.2.1(x64)
- Microsoft .NET CORE Runtime - 2.2.1(x86)
- Microsoft Visual C++ 2015 Redistributable(x86) - 14.024212
- Microsoft Visual C++ 2015 Redistributable(x64) - 14.024123
- Microsoft Visual C++ 2008 Redistributable - x86 - 9.0.30729.4148
- Microsoft Visual C++ 2008 Redistributable - x64 - 9.0.30729.6161
我从 Visual Studio 进行发布,在 IIS 上的模块中我有 AspNetCoreModuleV2。
我的 webconfig 文件内容如下:
<?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=".\App.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 9d04b7be-318b-4e95-aae3-c47aab07db30-->
CreateWebHostBuilder方法的代码:
return WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>().UseSerilog((ctx, cfg) =>
{
cfg.ReadFrom.Configuration(ctx.Configuration)
.MinimumLevel.Verbose()
.MinimumLevel.Override("Microsoft", LogEventLevel.Information);
});