什么是网:: ERR_INCOMPLETE_CHUNKED_ENCODING意思,我怎样可以解决? [英] What does net::ERR_INCOMPLETE_CHUNKED_ENCODING mean and how may I resolve it?

查看:2244
本文介绍了什么是网:: ERR_INCOMPLETE_CHUNKED_ENCODING意思,我怎样可以解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写一个生成在Bing Ads API报告的Web应用程序,以下这里看到的例子:

<一个href=\"http://msdn.microsoft.com/en-us/library/bing-ads-reporting-request-and-download-a-keyword-performance-report-in-php.aspx\" rel=\"nofollow\">http://msdn.microsoft.com/en-us/library/bing-ads-reporting-request-and-download-a-keyword-performance-report-in-php.aspx

我有code编译,但是在运行时,服务器突然结束该请求并返回这个code块的开始就ERR_INCOMPLETE_CHUNKED_ENCODING:

  $ WAITTIME = 30 * 1;
$ reportRequestStatus = NULL;//此示例轮询每隔30秒到5分钟。
//在生产中,你可以查询状态每隔1〜2分钟,最多一小时。
//如果调用成功,停止投票。如果来电或
//下载失败,则调用抛出故障。为($ I = 0; $ I小于10; $ I ++)
{
    睡眠($ WAITTIME);    // PollGenerateReport helper方法调用相应的Bing Ads服务操作
    //获取报告请求状态。    $ reportRequestStatus = PollGenerateReport(
            $代理,
            $ reportRequestId
            );    如果($ reportRequestStatus-&GT;状态== ReportRequestStatusType ::成功||
        $ reportRequestStatus-&GT;状态== ReportRequestStatusType ::错误)
    {
        打破;
    }
}

我试图通过行打印出来的价值观和调试这行,但我想不出是什么导致这个错误。谷歌搜索误差不弹出任何有关任。我不知道是否有人在此之前遇到的错误,并能告诉我是什么原因造成的?

谢谢!


解决方案

如果我不是错了 - 这是由于你的服务器的配置来处理各种请求

ASP.NET有一些配置设置,但简而言之分块请求完成后,你会得到这个错误之前,如果您刷新缓冲区。这里有一个链接,我发现前一段时间,当我遇到了类似的问题。祝你好运!

编辑:另外这里是介绍如何启用的响应处理,可能会导致您的问题的IIS页:
启用或禁用HTTP 1.1块传输编码


  

要启用HTTP 1.1块传输编码为万维网
  发布服务,请使用以下语法:appcmd设置配置
  /部分:ASP / enableChunkedEncoding:真|假真允许HTTP 1.1
  块传输编码,而假禁用HTTP 1.1分块
  传输编码。默认值是真。


  
  

..


  
  


  
  

要指定的默认​​时间长度ASP页让脚本运行
  终止剧本,写一个事件之前的Windows
  事件日志,请使用以下语法:appcmd设置配置/部分:ASP
  / scriptTimeout:时间跨度变量的时间跨度再presents最大
  时间(HH:MM:ss)表示ASP请求可以在事件之前运行写入
  到Windows事件日志。默认值是00:01:30。
   http://technet.microsoft.com/en -us /库/ cc730855(v = ws.10)的.aspx


也是这个家伙解释非常好:


  

    

ASP.NET数据到客户端的传输分块编码(Transfer-Encoding的:分块),如果你prematurely刷新响应
    流为HTTP请求和Content-Length头的
    响应没有明确设置。


  
  
  

通常这应该不是一个问题,因为大多数现代HTTP客户端
  能够处理这两个分块以及非分块服务器
  反应,去自动分块分块响应(注意,
  块传输编码只能通过HTTP 1.1规范)定义。


  
  

不过,就我自己来说,我正在一个异步Ajax调用的
  从JavaScript的ASP.NET Web服务。和纸幅的方法处理
  请求刷新响应明确的客户端,然后关闭
  响应(我需要做,因为该请求是从发行
  一个ExtJS商店的自动负载呼叫,我需要关闭
  在服务器上连接的客户端的存储,接受和负载
  在JSON序列数据)。


  
  

<一个href=\"http://www.rahulsingla.com/blog/2010/06/asp-net-sets-the-transfer-encoding-as-chunked-on-$p$pmature-flushing-the-response\" rel=\"nofollow\">http://www.rahulsingla.com/blog/2010/06/asp-net-sets-the-transfer-encoding-as-chunked-on-$p$pmature-flushing-the-response


I am writing a web application that generates a report from Bing Ads API, following the example seen here:

http://msdn.microsoft.com/en-us/library/bing-ads-reporting-request-and-download-a-keyword-performance-report-in-php.aspx

I have the code compiled, however when running, the server abruptly ends the request and returns ERR_INCOMPLETE_CHUNKED_ENCODING right at the beginning of this code block:

$waitTime = 30 * 1; 
$reportRequestStatus = null;

// This sample polls every 30 seconds up to 5 minutes.
// In production you may poll the status every 1 to 2 minutes for up to one hour.
// If the call succeeds, stop polling. If the call or 
// download fails, the call throws a fault.

for ($i = 0; $i < 10; $i++)
{
    sleep($waitTime);

    // PollGenerateReport helper method calls the corresponding Bing Ads service operation
    // to get the report request status.

    $reportRequestStatus = PollGenerateReport(
            $proxy, 
            $reportRequestId
            );

    if ($reportRequestStatus->Status == ReportRequestStatusType::Success ||
        $reportRequestStatus->Status == ReportRequestStatusType::Error)
    {
        break;
    }
}

I have tried to print out values and debug it line by line, but I cannot figure out what's causing this error. Googling the error doesn't bring up anything relevant either. I was wondering if anyone else has encountered this error before, and could tell me what is causing it?

Thanks!

解决方案

If im not mistaken - this is due to how you server is configured to handle various requests.

ASP.NET has some configuration settings but in a nutshell if you flush the buffer before the chunked request completes, you'll get this error. Here's a link I found some time ago when I ran into a similar problem. Good Luck!

Edit: Additionally here is an IIS page that describes how to enable the response handling that might be causing your issue: Enable or disable HTTP 1.1 chunked transfer encoding

To enable HTTP 1.1 chunked transfer encoding for the World Wide Web publishing service, use the following syntax: appcmd set config /section:asp /enableChunkedEncoding:True|False True enables HTTP 1.1 chunked transfer encoding whereas False disables HTTP 1.1 chunked transfer encoding. The default value is True.

..

and

To specify the default length of time that ASP pages let a script run before terminating the script and writing an event to the Windows Event Log, use the following syntax: appcmd set config /section:asp /scriptTimeout: timeSpan The variable timeSpan represents the maximum time (hh:mm:ss) that an ASP request can run before an event is written to the Windows Event Log. The default value is 00:01:30. http://technet.microsoft.com/en-us/library/cc730855(v=ws.10).aspx

also this guys explains it very well :

ASP.NET transfers the data to the client in chunked encoding (Transfer-Encoding: chunked), if you prematurely flush the Response stream for the Http request and the Content-Length header for the Response is not explicitly set by you.

Normally this should not be a problem because most modern HTTP clients are capable of handling both chunked as well as non-chunked server responses, de-chunking the chunked response automatically (Note that Chunked transfer encoding is defined only by HTTP 1.1 specification).

However, in my own case, I was making an asynchronous Ajax call to an ASP.NET web-service from javascript. And the web-method handling the request flushed the Response explicitly to the client, and then closed the Response (I needed to do so, because the request was issued from an auto-load call of an ExtJs store, and I needed to close the connection on the server for the client-side Store to accept and load the json serialized data).

http://www.rahulsingla.com/blog/2010/06/asp-net-sets-the-transfer-encoding-as-chunked-on-premature-flushing-the-response

这篇关于什么是网:: ERR_INCOMPLETE_CHUNKED_ENCODING意思,我怎样可以解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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