【问题标题】:Why would large POST requests not reach my Azure web role?为什么大型 POST 请求无法到达我的 Azure Web 角色?
【发布时间】:2013-07-29 14:03:50
【问题描述】:

在我的 Azure Web 角色中,处理大于约 3000 万字节的 POST 请求时出现问题。我知道有 IIS 过滤器可以检测所有大于 3000 万字节的请求并将其结果设置为 404。但我希望这些 404 代码会显示在 IIS 日志中。

我的 Web 角色的一个用户面临以下行为:对我的 Web 角色中小于约 3000 万字节的特定 URL 的 POST 请求通过正常(我在 IIS 日志中看到它们)但 POST 请求更大比这(到相同的 URL)为客户端生成 HTTP 503(服务不可用)代码,我没有在 IIS 日志中看到这些请求。

这是一个长 POST 示例的标题

POST /mySpecificUrl?paramshere HTTP/1.1
User-Agent: Custom USer Agent
Content-Type: application/octet-stream
Proxy-Authorization: NTLM LongBase64StringHere
Host: my.hostname.here
Content-Length: content length here - about 32 megabytes
Expect: 100-continue

看起来有些东西正在拦截这些请求 - 可能是负载平衡器或其他东西,因此它们无法发挥我的作用。

现在用户使用 Fiddler,他声称当他获得代码 503 时,将返回以下内容:

Hello,
A communication error occurred: ""
The Web Server may be down, too busy, or experiencing other
problems preventing it from responding to requests.
You may wish to try again at a later time.

制作为 HTML。此内容附带的标头不包含我们在每个响应中注入的自定义标头,因此这是请求未到达 IIS 的又一证据。

如何找出导致此行为的原因以及如何控制它(例如,更改请求大小阈值)?

【问题讨论】:

  • 尝试伪造Content-Length 标头并查看是否将条目添加到失败的请求日志中。
  • 你发布的内容是异步的吗?
  • @ThiagoCustodio:这是另一个用户代码,但他使用我们的示例,其中 POST 是同步的,所以我猜除非他用棒球棒调整它,否则它是同步的。
  • @sharptooth 你可以在这里发布你的示例帖子吗?
  • @ThiagoCustodio:我已经添加了标题。

标签: iis azure azure-web-roles


【解决方案1】:

我完全确定某些东西阻止了访问 IIS 的请求。可能是防火墙规则或负载均衡器,这就是您在 IIS 中看不到日志的原因。坏消息是,我无法找到一种方法来告诉您将发布大量内容。

尝试将此配置应用于“ServiceDefinition.csdef”文件,看看它是否会有所帮助:

<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="WindowsAzure1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2013-03.2.0">
  <LoadBalancerProbes>
    <LoadBalancerProbe protocol="http" name="config" timeoutInSeconds="36000"></LoadBalancerProbe>
  </LoadBalancerProbes>
  <WebRole name="webRoleConfig">
    <Runtime executionContext="elevated"></Runtime>
  </WebRole>  
</ServiceDefinition>

【讨论】:

    【解决方案2】:

    经过大量努力进行调查并提出支持请求,得出的结论是,Azure 之外有一些软件会发出该消息,可能是某个代理服务器之类的。

    我们的服务配置了&lt;system.webServer&gt;&lt;security&gt;&lt;requestFiltering&gt;&lt;requestLimits maxAllowedContentLength 不匹配 &lt;system.web&gt;&lt;httpRuntime maxRequestLength&gt;this is known to cause IIS return HTTP 500 and close the connection for requests with lengths in certain range。这只是一个猜测,但也许其他软件会拦截 HTTP 500 响应并发出“Hello”消息。

    我问this question on ServerFault 找出已知哪个软件会发出此消息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-05-16
      • 1970-01-01
      • 1970-01-01
      • 2011-05-21
      • 2017-05-07
      • 1970-01-01
      • 2021-09-02
      • 1970-01-01
      相关资源
      最近更新 更多