2

I installed .NET Core version 2.1.3 for my new computer running Windows Server 2016. I hosted it in IIS 10. But it gave me Error 502:

HTTP Error 502.5 - Process Failure

Common causes of this issue: The application process failed to start The application process started but then stopped The application process started but failed to listen on the configured port

This is my snippet for web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\WebApplication1.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
  </system.webServer>
</configuration>
TylerH
  • 20,799
  • 66
  • 75
  • 101
Truc
  • 386
  • 4
  • 12
  • Do really need to use web.config file or launchSetting .json ? – Ankur Shah Jun 06 '18 at 06:41
  • web.config file was generate automation in project – Truc Jun 06 '18 at 06:45
  • which template you are using to create your project? – Ankur Shah Jun 06 '18 at 06:49
  • I use "Web Application" and API, but both of them have same error – Truc Jun 06 '18 at 06:51
  • I think you are using wrong template create .net core – Ankur Shah Jun 06 '18 at 07:15
  • 1
    @AnkurShah: `launchSettings.json` is for IDE when starting with F5 or in debug mode. Its not used by webservers or the application itself – Tseng Jun 06 '18 at 07:28
  • @Truc: Did you made sure the Hosting Bundle is installed on the Windows Server machine running IIS? https://www.microsoft.com/net/download/windows its usually included in the sdk but you rarely install the sdk on the server machines, just runtime + hosting bundle. See [docs](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/aspnet-core-module?view=aspnetcore-2.1) and [Host on IIS](https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/index?view=aspnetcore-2.1&tabs=aspnetcore2x). The ANCM (ASP.NET Core Module) is part of the hosting bundle and required to run in iis – Tseng Jun 06 '18 at 07:32
  • You might already have all bits installed, but it is time to follow this thread to enable more logging, https://github.com/aspnet/IISIntegration/issues/406 – Lex Li Jun 06 '18 at 11:55
  • Try to use followign guide: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.1&tabs=aspnetcore2x REMEMBER to restart iis with following commands: "net stop was /y" and "net start w3svc" – Sierrodc Jul 20 '18 at 08:29

3 Answers3

1

Ensure the following:

  1. .NET Core Hosting Bundle installed on the hosting server - download from here
  2. Application Pool .NET CLR version set to "No Managed Code"
  3. Ensure that the Application Pool Identity user has read permissions on the published folder. For details check: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.0
Mohsin Mehmood
  • 4,156
  • 2
  • 12
  • 18
0

The is a situation that if you use:

Env: Windows Server OS, .NET Core Hosting Bundle(including runtime), IIS, Asp.Net.Core

You could add a element as follows into {YourProject}.csproj file:

<PropertyGroup>
  <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>

Ref: https://github.com/dotnet/coreclr/issues/13542

John Jang
  • 2,567
  • 24
  • 28
0

Alternatively, For anyone who still struggling with .net core on IIS while running nuget package Microsoft.Aspnetcore.all 2.1.3, i will recommend to update the version to 'Latest Stable 2.1.301' as Microsoft has released the fix

Other version with IIS issue is Microsoft.Aspnetcore.all 2.0.8 either upgrade to 'Latest Stable 2.1.301' or downgrade to 2.0.7.

No code or .csproj needed for changing needed.

Neo Soko
  • 137
  • 6