[英].Net core Service Unavailable after Publish to IIS
After I published my up to IIS when I try to access it I get the error: Service Unavailable当我尝试访问它时将我的 up 发布到 IIS 后,我收到错误:服务不可用
HTTP Error 503. The service is unavailable.
http错误503服务不可用。
What should I do next?我接下来该怎么做?
I use Windows Server 2008(64 - bit) with IIS 8.5.我使用带有 IIS 8.5 的 Windows Server 2008(64 位)。 The app is web api .NET CORE 2.2.1.
该应用程序是 web api .NET CORE 2.2.1。
On the Windows machine I have installed:在我安装的 Windows 机器上:
I made a publication from the visual studio.我从视觉工作室发表了一篇文章。 Into IIS on modules i have AspNetCoreModuleV2.
在模块上进入 IIS 我有 AspNetCoreModuleV2。
The webconfig file I have:我拥有的 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-->
Code from CreateWebHostBuilder Method: CreateWebHostBuilder 方法中的代码:
return WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>().UseSerilog((ctx, cfg) =>
{
cfg.ReadFrom.Configuration(ctx.Configuration)
.MinimumLevel.Verbose()
.MinimumLevel.Override("Microsoft", LogEventLevel.Information);
});
you can check below steps to dedect issue.您可以检查以下步骤来检测问题。
dotnet yourapp.dll
and then press enter.) dotnet yourapp.dll
,然后按 Enter。) If you have your application running under an IIS and you set a binding with https, you need to specify a url with the SSL certificate associated to it, when you run dotnet yourapp.dll
by default it will run on localhost if you don't specify on your Program.cs a call to UseUrls.如果您的应用程序在 IIS 下运行并设置了与 https 的绑定,则需要指定一个带有与其关联的 SSL 证书的 url,当您运行
dotnet yourapp.dll
,默认情况下它将在 localhost 上运行,如果您不这样做在 Program.cs 上指定对 UseUrls 的调用。 Then you can call your dotnet yourapp.dll
and it will work然后你可以调用你的
dotnet yourapp.dll
并且它会工作
var host = new WebHostBuilder() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup() .UseUrls(" http://mywebsite.com ") .Build(); var host = new WebHostBuilder() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup() .UseUrls(" http://mywebsite.com ") .Build();
if app starting properly with dotnet command check access level of log file location(".\\logs\\stdout").如果应用程序使用 dotnet 命令正确启动,请检查日志文件位置的访问级别(“.\\logs\\stdout”)。 To give the applicationpool user the ability to read and write, perform the following steps https://stackoverflow.com/a/7334485/4172872
要让应用程序池用户能够读写,请执行以下步骤https://stackoverflow.com/a/7334485/4172872
UPDATE:更新:
Is the extension of the application really ".exe"?应用程序的扩展名真的是“.exe”吗?
<aspNetCore processPath=".\App.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
Also this https://github.com/dotnet/aspnetcore/issues/10117 - it's an ongoing open issue with .NET Core还有这个https://github.com/dotnet/aspnetcore/issues/10117 - 这是 .NET Core 的一个持续开放的问题
This was not an issue with the "old" ASP.NET because it was able to "overlap" requests into two process :(这不是“旧”ASP.NET 的问题,因为它能够将请求“重叠”到两个进程中:(
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.