在读取结束之前,响应流是否处​​理?

时间:2017-10-17 13:26:29

标签: c# wcf

流式服务的示例合约:

public interface IFileService
{
    Stream Download(int id);
}

示例客户:

var proxy = ...
using(var responseStream = proxy.Download(666))
{
     while(true)
     {
          var someBytes = //responseStream.Read(...)
          if(someBytes[0] == 11)
              return;//here is called dispose by using statement, but stream will call Read in it's Dispose method!
     }
}

所以,是的,如果你决定从你的10GB文件的开始只分析几个字节并离开这一点 - 你将注定要等到WCF CloseTimeout到期,或者直到你读完整个10GB文件,根据{ {3}}。

如何告诉WCF停止阅读整个流而没有“zerofying” closeTimeout 选项的廉价技巧?

0 个答案:

没有答案