0
votes

Windows Service self-hosted application, when it is starting, it has to pre-load data and this could take 60 seconds. So the app call RequestAdditionalTime on startup to avoid timeout error.

This works fine before. Recently we upgraded to ASP.NET Core 2.0, self-hosted in Windows Service, the approach is described in Microsoft doc here. TargetFramework is set to net472

Within the derived class of WebHostService, RequestAdditionalTime is called as below.

public class CustomWebHostService : WebHostService
{
    public CustomWebHostService(IWebHost host) : base(host)
    {

    }

    protected override void OnStarting(string[] args)
    {
        this.RequestAdditionalTime(1000 * 60 * 5);
        base.OnStarting(args);
    }

    protected override void OnStarted()
    {
        this.RequestAdditionalTime(1000 * 60 * 5);
        base.OnStarted();
    }
}

But it does not work.

The service did not respond to the start or control request in a timely fashion. A timeout was reached (30000 milliseconds) while waiting for the XXXX service to connect.

Now I fixed this issue by editing the registry

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control]
"ServicesPipeTimeout"=dword:0002bf20

Does anyone know why RequestAdditionalTime does not work any more?

1
which version of .net core? - Daniel A. White
ASP.NET Core 2.0 running on .NET framework 4.7.2 - Mr.Wang from Next Door

1 Answers

0
votes

You are requesting 5 minutes, but the hard maximum is 2 minutes. any values greater than two minutes will be ignored and the limit stays at what is configured in the registry.