none
SL3 + WCF + Stream response - is it possible?

    Question

  • SL3 gurus,

    I'm trying to get a truly stream-oriented connection from a SL3 client app calling my WCF operation with the result being streamed back to the client via the System.IO.Stream class.  I have a basic WCF service contract:

    • Stream GetStreamResult (string query, int maxResults) 

    I tried to get this working from my SL3 client, but could not.  There were no errors, other than the MemoryStream I re-hydrated from the resulting byte[] was empty.  This began my suspicion - the "Add Service Reference" did not have the async method returning a Stream, but instead a byte[].  So, I decided to modify my service.  After changing the OperationContract to be:

    • byte[] GetStreamResult (string query, int maxResults)

    it appears to work. My question is, is this truly streaming, or am I just doing a buffered query of my byte[]?  I have set this up to use the following custom binding configuration in the WCF service:

    <binding name="streamHttpBinding">

    <binaryMessageEncoding />

    <httpTransport transferMode="Streamed" />

    </binding>

    but you cannot set the TransferMode on the SL3 side, so I don't know if this is actually streaming or not.

    I have the potential for some large streams of data and would like to know if you can actually set up a connection between SL3 and WCF where the transport/binding TransferMode=Streamed or StreamingResponse.

    Is this possible?  Thanks and let me know if you need any further information,

    Bob

    Thursday, August 13, 2009 6:05 PM

Answers

All replies