是什么混淆或导致我的 Http Web 请求标头有时包含“Proxy-Connection”而不是“连接”?

发布于 2024-11-19 18:37:31 字数 930 浏览 2 评论 0原文

我有一个 C#.NET 桌面应用程序,它经常连接到 ASMX Web 服务。有两个后台工作人员非常频繁地连接到此 Web 服务。该应用程序还有两个 Web 浏览器控件,其形式可以从 ASP.NET 网站加载两个不同的网页。这些页面也有持续不断的 AJAX 请求。

问题:有时一些请求 - 既通过网络参考又通过XMLHttp 在浏览器页面中被卡住。我使用 fiddler 检查,发现这些请求得到 http 状态 502 响应,并且实际上在 TCP IP 连接上失败了。我发现的问题模式/原因是,来自应用程序的所有 http Web 请求通常包含“Connection”标头,但某些随机请求包含“Proxy-Connection”标头。并且可以肯定的是,502 错误总是且仅由这些带有“Proxy-Connection”标头的请求引起。

如果这是问题的原因,我想知道是什么导致某些请求发送“Proxy-Connection”标头而不是正常的“Connection”标头?

更新:当我不断使用 fiddler 测试和监控这一点时 - 我现在有了一个新发现。当应用程序正在运行并且 fiddler 正在捕获日志时 - 我随机在请求标头中搜索日志中的“代理”,有时它会说“1 个会话包含‘代理’”,但下一刻当我再次研究时它会说“0 个会话包含‘代理人'”。当它说“1 个会话包含‘代理’”时,我什至快速保存了所选日志,但当我稍后检查该保存的日志时,它在请求标头中不包含“代理”,并且状态也是 200(而不是 502)。现在,当我使用 fiddler 捕获实时日志时,我发现几乎所有(或大多数)请求实际上都以“Proxy-Connection”标头开始,在请求完成时该标头会更改为“Connection”。那么未完成的请求是否会保留“Proxy-Connection”标头?

有什么线索吗?我很困惑,并试图弄清楚至少一个事实 - Proxy-Connection 标头是否导致 502 错误?或者 502 错误导致了 Proxy-Connection 标头?

I have a desktop application in C#.NET that is very frequently connecting to a ASMX web service. There are two background workers those are connecting to this web services very frequently. The application also has two web browser controls in the form that load two different web pages from a ASP.NET website. These pages also have constant AJAX requests going on.

Problem: Sometimes some of the requests - both through the web reference & XMLHttp in the browser pages get stuck. I checked using fiddler and found that these requests get a http status 502 response and had actually failed at TCP IP connection. The pattern/cause of problem that I have identified is that all the http web requests from the application normally contain the "Connection" header, but some requests at random instead contain the "Proxy-Connection" header. And it is sure that the 502 error is caused ALWAYS and ONLY for these requests with "Proxy-Connection" header.

If this is the cause of the issue, I am wondering what is it that causes some of the requests to send the "Proxy-Connection" header instead of normal "Connection" header?

UPDATE: As I constantly testing and monitoring this using fiddler - I have a new finding now. While the application is running and fiddler is capturing logs - I randomly search the logs for "Proxy" in request headers and sometimes it says "1 sessions contained 'Proxy'" but the next moment when I research again it says "0 sessions contained 'Proxy'". I have even quickly saved the selected log when it said "1 sessions contained 'Proxy'" but when I later check that saved log, it does NOT contain 'Proxy' in request headers and the status is also 200 (not 502). Now as I am playing with the fiddler capturing live logs, I see that almost all (or most) of the requests actually start with the "Proxy-Connection" header that gets changed to "Connection" by the time the request completes. So does this that the requests that do not complete retain the "Proxy-Connection" header?

Any clue? I am confused and trying to figure out atleast the fact that - whether Proxy-Connection header is causing the 502 error? OR the 502 error is causing the Proxy-Connection header?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

过气美图社 2024-11-26 18:37:31

您和网络服务器之间必须有一些代理。如果您查看 http://www.checkupdown.com/status/E502.html HTTP 502 错误通常是因为代理或网关无法连接到目标服务器而出现。通常,这可能是由于连接问题或负载问题(如果您通过自己的路由器运行,则可能是连接问题,如果您通过 ISP 的透明代理运行,则可能是其中之一)。

您无能为力来阻止该错误,您必须编写代码来捕获此错误并重试。

所以回答你的问题:

是否是 Proxy-Connection 标头导致 502 错误?或者 502 错误导致了 Proxy-Connection 标头?

Proxy-Connection 标头指示某个代理或网关在连接到 Web 服务时出现错误。它本身并不是 502 错误的原因,502 错误也不是 Proxy-Connection 标头的原因。

There must be some proxy sitting between you and the web server. If you look at http://www.checkupdown.com/status/E502.html the HTTP 502 error typically arises because the proxy or gateway can't connect to the destination server. Typically this is either due to connectivity issues or load issues (if you're running through your own router then it's probably connectivity, if you're running through a transparent proxy from your ISP, then it could be either).

There's not much you can do to stop the error, you'll have to write your code to catch this error and retry.

So to answer your question:

whether Proxy-Connection header is causing the 502 error? OR the 502 error is causing the Proxy-Connection header?

The Proxy-Connection header is an indication of some proxy or gateway having an error connecting to the web service. It is not in itself the cause of the 502 error, and the 502 error is not the cause of the Proxy-Connection header.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文