Returning stream from a WCF Service to the client
-
Hi, I am developing an application that calls a WCF service which connects to a remote server and downloads a file. The remote server returns a Stream object for each download request. Is it possible to return the stream from the WCF service to the client? Pls advice. Thanks, ramz_g
-
Hi, I am developing an application that calls a WCF service which connects to a remote server and downloads a file. The remote server returns a Stream object for each download request. Is it possible to return the stream from the WCF service to the client? Pls advice. Thanks, ramz_g
Check out this article: Stream Operation in WCF[^]
-
Check out this article: Stream Operation in WCF[^]
Hi MREcoolio, Thanks for your reply... I was able to transfer a stream to my client without any trouble when the file size is less than 64kb ("maxReceivedMessageSize" property of the "binding" element)... I understand that this is the default size limit and that we can change it to suit our requirements... But my problem is that no matter how large a number I specify for the "maxReceivedMessageSize" property, I get a communication fault exception. The following are the server and client config files for your reference.. The configuration as I said, works perfectly fine for files whose sizes are lesser than 64kb.. Am I missing something here? Server Side App.config:
<system.serviceModel>
<bindings>
<netNamedPipeBinding>
<binding name="MyNetNamedPipeBinding" closeTimeout="01:01:00" openTimeout="01:01:00" receiveTimeout="00:10:00" sendTimeout="01:10:00" transactionFlow="false" transferMode="Streamed" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxBufferSize="10333" maxConnections="10" maxReceivedMessageSize="9223372036854775807">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport protectionLevel="EncryptAndSign" />
</security>
</binding>
</netNamedPipeBinding>
</bindings>
<services>
<service name="MyService" behaviorConfiguration="metadataSupport">
<host>
<baseAddresses>
<add baseAddress="net.pipe://localhost/MyService" />
</baseAddresses>
</host>
<endpoint address="" binding="netNamedPipeBinding" bindingName="MyNetNamedPipeBinding" contract="MyContract" />
<endpoint address="mex" binding="mexNamedPipeBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="metadataSupport">
<serviceMetadata />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors></system.serviceModel>
Client Side App.config:
<system.serviceModel>
<bindings>