After I published my up to IIS when I try to access it I get the error: Service Unavailable
HTTP Error 503. The service is unavailable.
What should I do next?
I use Windows Server 2008(64 - bit) with IIS 8.5. The app is web api .NET CORE 2.2.1.
On the Windows machine I have installed:
I made a publication from the visual studio. Into IIS on modules i have AspNetCoreModuleV2.
The webconfig file I have:
<?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:
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.)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. Then you can call your dotnet yourapp.dll
and it will work
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"). To give the applicationpool user the ability to read and write, perform the following steps https://stackoverflow.com/a/7334485/4172872
UPDATE:
Is the extension of the application really ".exe"?
<aspNetCore processPath=".\App.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />