Obi*_*bin 5 c# server-sent-events asp.net-core-mvc .net-core asp.net-core
我想检测与 ASP.NET Core 上的 SSE(服务器发送事件)的断开连接。老方法Response.IsClientConnected
不行。你有解决这个问题的方法吗?
我找到了我的问题的临时解决方案。临时原因IsCancellationRequested
是在尝试发送请求时检测到并且失败,而不是在用户在发送请求之前断开连接时
if (HttpContext.RequestAborted.IsCancellationRequested == true)
{
break;
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1780 次 |
最近记录: |