Kestrel + IIS反向代理请求已中止未触发 [英] Kestrel + IIS Reverse Proxy RequestAborted Not Triggered

查看:143
本文介绍了Kestrel + IIS反向代理请求已中止未触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个ASP.NET Core 2.x应用程序,该应用程序实现了自定义中间件,该中间件充当了另一个(基于Java)服务器/应用程序前面的代理.通常,此应用程序/中间件的客户端会在服务器请求完成之前频繁中止/取消其请求.

我们已将此应用程序部署到IIS(作为反向代理)并在Kestrel上运行. 在Core 2.x之前,Kestrel的错误导致HttpContext.RequestAborted始终为false (其他相关问题,此处)...显然已经在2.x版中修复了(我已经确认了).

但是,似乎在Kestrel前面运行IIS时,它不会将请求中止转发给Kestrel,并且RequestAborted总是 still 总是false

是否有任何方法可以使RequestAborted在此配置下工作(如果没有,请以其他任何方式进行检测)?

简单的复制仓库: https://github.com/mikeomeara1/RequestAbortRepro

更新

此评论似乎表示一个已知问题,但很大程度上不清楚到什么程度

这个问题似乎也有关联,但对我来说并不完全清楚它是直接相关的(至少在这种情况下并没有明确说明).

@spender-如果我对您的理解正确,则标题比较为此处.如果没有,请告诉我,我会带给您您想看的任何东西.

似乎茶叶表明存在已知问题.所以,问题是;有办法解决这个问题吗?我们刚刚经历了(非常痛苦的)1.1到2.x升级,希望这个问题能够得到解决,并且让我们的服务器在接下来的一个月/季度/年内遭受重创,这让我们在这一点上非常关注.我们正在开发的系统的体积正在大大增加.

因此,欢迎任何变通方法,hack或疯狂的想法.

解决方案

这是已知问题,尚未解决.参见 https://github.com/aspnet/AspNetCoreModule/issues/38

We have an ASP.NET Core 2.x Application that implements custom middleware that acts as a proxy in front of another (Java based) server/application. It is common for the clients of this application/middleware to frequently abort/cancel their request before the server request has completed.

We've deployed this application to IIS (as a reverse proxy) and running on Kestrel. Prior to Core 2.x Kestrel had a bug that caused HttpContext.RequestAborted to always be false (other related question here)...which was apparently fixed in 2.x (which I've been able to confirm).

However, it appears that when running IIS in front of Kestrel, it doesn't forward the request abort through to Kestrel and RequestAborted is still always false

Is there any way to get RequestAborted working in this configuration (or any other way to detect it if not)?

Simple reproduction repo: https://github.com/mikeomeara1/RequestAbortRepro

UPDATE

This Comment seems to indicate a known issue but it's largely unclear to what extent

This Question seems to also be related but again it's not completely apparent to me that it's directly related (at least it isn't spelled out in such terms).

@spender - If I understood you correctly, the header comparison is here. If not, let me know, I'll get you whatever you want to see.

It seems the tea leaves are indicating a known issue. So, the question is; Is there a way to work around this? We just went through (a very painful) 1.1 to 2.x upgrade in the hopes this issue would be addressed and letting our server thrash for another month/quarter/year has us pretty concerned at this point. The system we're working on is greatly scaling up in volume.

So, any workarounds, hacks or crazy ideas are welcome.

解决方案

This is known issue and isn't fixed yet. See https://github.com/aspnet/AspNetCoreModule/issues/38

这篇关于Kestrel + IIS反向代理请求已中止未触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆