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?