> believe there is a way of sending a Stream that can be read in chunks and allow progress reporting. Is that right? Anyone done it?


Yep, define this contract

|[ServiceContract]
public interface ISoftwareUpdater
{
    [OperationContract()]
    *Stream*GetDownloadStream(FileUpdate fileUpdate);
}
|

Define your endpoint as normal and your binding as:

|<binding name="NetTcpStreamedBinding" openTimeout="00:00:20" sendTimeout="00:30:00" receiveTimeout="00:30:00" 
closeTimeout="00:00:01" maxReceivedMessageSize="10067108864"*transferMode="Streamed"*>
                    <security mode="Transport">
                        <transport clientCredentialType="None"/>
                    </security>
                </binding>
|

which allows you to use a stream.



On 20/09/2011 12:58 PM, Greg Keogh wrote:

Folks, I have a WCF service hosted in IIS that is called by an SL4 app to send client files to the server. Years ago I updated various configuration values to allow up to 20MB transfer. This is on the server side:

<bindingname="Bind1"maxBufferSize="20971520"maxReceivedMessageSize="20971520"

maxBufferPoolSize="20971520">

<readerQuotasmaxArrayLength="131072"maxBytesPerRead="20971520"maxDepth="20971520"

maxStringContentLength="20971520"maxNameTableCharCount="131072"/>

On the client side I set:

publicconst int MaxBufferSize = 20971520;

:

bind.MaxBufferSize = LaserMetrics.MaxBufferSize;

bind.MaxReceivedMessageSize = LaserMetrics.MaxBufferSize;

However I just reproduced a problem where a 7MB file is causing an exception inside the WCF call. It dies on the WCF method asynch callback with this error:

System.ServiceModel.CommunicationException occurred

  Message=The remote server returned an error: NotFound.

There is nowhere I can break to find out what's going on, so I was wondering if there is a trick to get more out of the underlying exception. There's probably an obscure config settings I haven't found yet. I presume there is some size related config option that I've missed somewhere, but where.

Perhaps I should use some sort of "streaming" technique between SL4 and the service, but I've not needed it before and haven't read up on exactly how it's done. I believe there is a way of sending a Stream that can be read in chunks and allow progress reporting. Is that right? Anyone done it?

Cheers,

Greg


Reply via email to