Search code examples
.netwcfstreaming

WCF Streaming Times Out


I guess to begin I should ask whether Streaming WCF works without MTOM or if MTOM is required? I was using MTOM, but it didn't work with our Mono based macOS client, so we had to turn it off.

We have a WCF web app hosted on IIS.

Here is the binding on the client:

    <binding name="BasicHttpBinding_IDataService" transferMode="Streamed"
                             sendTimeout="01:05:00" maxReceivedMessageSize="504857600">
      <security mode="Transport">
        <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
      </security>
    </binding>

Here is the binding on the server:

            <binding name="BasicHttpBinding_IDataService" transferMode="Streamed" sendTimeout="01:05:00" maxReceivedMessageSize="130000000">
                <readerQuotas maxArrayLength="104857600" maxStringContentLength="104857600" />
                <security mode="Transport">
                    <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
                </security>
            </binding>

I called one of the methods on the client called ReceiveAsync. It returns a stream object. I then make calls on the stream object to download the data.

The problem I have is that it appears that the call to ReceiveAsync doesn't return until the whole file is returned which seems more like Buffered than Streamed.

If this runs on a slow enough network connection, it times out on the called to ReceiveAsync.

Why doesn't the ReceiveAsync return right away and then allow my to stream the file data?


Solution

  • Turns out that the .net 4.5.2 implementation that is included in Visual Studio 2017 doesn't seem to support the streaming mode.

    I ended up adding a REST download for large files and that works for me.