Skip to content

Windows service crash when stop it #31434

@analogrelay

Description

@analogrelay

From @dospat07 on Wednesday, September 25, 2019 2:18:37 PM

To Reproduce

Steps to reproduce the behavior:

  1. Using this version of ASP.NET Core 3.0 and Visual Studio 2019 version 16.3
  2. Create new ASP.NET core API web application
  3. Add Microsoft.Extensions.Hosting.WindowsServices
  4. Change method CreateHostBuilder to
public static IHostBuilder CreateHostBuilder(string[] args) =>
          Host.CreateDefaultBuilder(args)
              .UseWindowsService()
              .ConfigureWebHostDefaults(webBuilder =>
              {
                  webBuilder.UseStartup<Startup>();
              });
  }
  1. change appsettings.json to
{
     "Logging": {
        "EventLog": {
              "LogLevel": {
                     "Default": "Warning"      
                               }
                        }
                 },
       "AllowedHosts": "*"
}
  1. create windows service via sc or powershell
  2. start service
  3. stop service
  4. Error found in Application log in EventViewer
    Faulting application name: WebApplication3.exe, version: 1.0.0.0, time stamp: 0x5d7bb03a
    Faulting module name: ntdll.dll, version: 6.3.9600.19304, time stamp: 0x5c7f684f
    Exception code: 0xc0000374
    Fault offset: 0x00000000000f1cd0
    Faulting process ID: 0x3eb0
    Faulting application start time: 0x01d573a4eb992a85
    Faulting application path: C:\Users\xxx\Source\repos\WebApplication3\WebApplication3\bin\Debug\netcoreapp3.0\WebApplication3.exe
    Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
    Report ID: 4cb3564a-df98-11e9-82b2-082e5f215ab6
    Faulting package full name:
    Faulting package-relative application ID:

Copied from original issue: dotnet/extensions#2396

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions