How can I stream a response from WCF without buffering?

后端 未结 3 1711
攒了一身酷
攒了一身酷 2021-02-09 10:53

I have a restful (webHttpBinding) self-hosted WCF service. Most methods are returning xml or json version of objects to the client.

I have a couple of GET methods that t

3条回答
  •  离开以前
    2021-02-09 11:08

    I do file streaming like this:

    Group the methods that returns data which needs to be streamed into an endpoint and then add the streamed transferMode on that endpoint.

    Here is the configuration I use (for basicHttpBinding).

    
      
        
      
    
    

    and the define the binding configuration:

    
        
            
        
    
    

    Basically, you have to set the transferMode in the binding configuration.

    I haven't tried it with webHttpBinding, so please let me know if it works for you.

提交回复
热议问题