首页 > 解决方案 > kestrel 后面的 Dotnet 站点停止工作(请求从 Apache 服务器返回 503)

问题描述

我在 Linux 机器上运行 .NET core 3.1 应用程序,Kestrel 在反向代理 (Apache) 后面。我不断地将一些数据推送到某个端点,然后通过 signalR 集线器将这些数据转发给用户:

        [HttpPut("{tagName}/live")]
    [Authorize(Roles = "Datasource")]
    [ProducesResponseType(StatusCodes.Status200OK)]
    [ProducesResponseType(StatusCodes.Status400BadRequest)]
    [ProducesResponseType(StatusCodes.Status401Unauthorized)]
    [ProducesResponseType(StatusCodes.Status403Forbidden)]
    [TypeFilter(typeof(TagControllerFilterAttribute))]
    public async Task<IActionResult> PutLiveTag(Tag tag, string tagName)
    {
        bool status = await tagRepository.UpdateLiveData(tagName, tag);
        if (status)
        {
            await tagHubContext.Clients.Group(tagName).SendAsync(tagName, tag);
            return Ok();
        }
        return BadRequest();
    }

用户只需将其从组中删除即可加入和离开该信号器集线器:

    public class TagDataHub : Hub
{
    [HubMethodName("subscribe")]
    public async Task JoinTagGroup(string tagName)
    {
        await Groups.AddToGroupAsync(Context.ConnectionId, tagName);
    }
    [HubMethodName("unsubscribe")]
    public async Task LeaveTagGroup(string tagName)
    {
        await Groups.RemoveFromGroupAsync(Context.ConnectionId, tagName);
    }
}

我的应用程序在部署中运行了几个小时,然后当我尝试使用该应用程序的 API 端点或与该应用程序相关的任何东西时,我得到 503 来自Apache的响应。我真的不知道为什么 Kestrel 停止工作......当我运行时,service dotnet-site status我发现该应用程序仍在运行。

我检查了服务器中的进程,我看到 dotnet 使用了大量资源,但除了上面提供的代码之外,该应用程序中没有其他任何东西在运行: 过程统计

请发送帮助我真的不知道如何在 linux 服务器上调试/解决这个问题,我会重视任何建议。

我也查了这个并完全按照这个人做,但它没有帮助我:apache mpm worker

标签: asp.net-coresignalrsignalr-hubkestrel-http-server

解决方案


推荐阅读