【问题标题】:RequestAdditionalTime not working after upgrading to ASP.NET Core升级到 ASP.NET Core 后,RequestAdditionalTime 不起作用
【发布时间】:2017-12-22 01:53:43
【问题描述】:

Windows 服务自托管应用程序,当它启动时,它必须预加载数据,这可能需要 60 秒。所以应用程序在启动时调用RequestAdditionalTime以避免超时错误。

这以前可以正常工作。 最近我们升级到 ASP.NET Core 2.0,在 Windows 服务中自托管,该方法在 Microsoft doc here 中进行了描述。 TargetFramework 设置为 net472

WebHostService的派生类中,RequestAdditionalTime的调用方式如下。

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();
    }
}

但它不起作用。

服务没有及时响应启动或控制请求。 等待 XXXX 服务连接时超时(30000 毫秒)。

现在我通过编辑注册表解决了这个问题

Windows Registry Editor Version 5.00

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

有人知道为什么RequestAdditionalTime 不再起作用了吗?

【问题讨论】:

  • .net core 的哪个版本?
  • 在 .NET Framework 4.7.2 上运行的 ASP.NET Core 2.0

标签: .net asp.net-core .net-core asp.net-core-2.0


【解决方案1】:

您请求 5 分钟,但硬性最大值为 2 分钟。任何大于两分钟的值都将被忽略,限制停留在注册表中配置的值。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-05-12
    • 1970-01-01
    • 1970-01-01
    • 2018-01-28
    • 2010-12-18
    • 2019-05-08
    • 2022-11-29
    • 1970-01-01
    相关资源
    最近更新 更多