2009-12-17 79 views
2

我试图通过WCF传输一些文件,但只要从客户端的方法被调用时,我得到以下信息:WCF流媒体文件传输

The socket connection was aborted. This could be caused by an error processing 
your message or a receive timeout being exceeded by the remote host, or an 
underlying network resource issue. Local socket timeout was '00:10:00'. 

我的方法是裹着try...catch ,所以如果在服务器上的方法中有任何引发异常的情况,它应该将其记录到控制台窗口,但是没有记录。我也曾尝试在本地运行服务器并在该方法上设置断点,并且该方法似乎并没有被调用。

是否有一个属性或需要在net.tcp连接上设置以允许在客户端进行流式传输?

回答

4

是否有 需要 的连接的net.tcp上设置属性或东西允许在客户端流?

是的 - 当然!你需要设置你的客户端配置使用流 - 无论是在一个方向(如果你想上传东西到服务器StreamedRequest,或StreamedResponse,如果你想从服务器上下载,或只是简单的串流播放如果你流两种方式)。

<system.serviceModel> 
    <bindings> 
    <netTcpBinding> 
     <binding name="streaming" 
      transferMode="StreamedResponse"> 
     </binding> 
    </netTcpBinding> 
    </bindings> 
    <client> 
    <endpoint name="StreamEndpoint" 
       address="..." 
       binding="netTcpBinding" 
       bindingConfiguration="streaming" 
       contract="IYourService" /> 
    </client> 
</system.serviceModel> 

您需要定义你的绑定配置下一个名字(任何你喜欢的),然后在bindingConfiguration=属性指定名称引用在<endpoint>该配置。

有关更多详细信息,请参阅How to: Enable Streaming上的MSDN文档页。