Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WCF and WF
  4. Returning stream from a WCF Service to the client

Returning stream from a WCF Service to the client

Scheduled Pinned Locked Moved WCF and WF
csharpwcfsysadminquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    ramz_g
    wrote on last edited by
    #1

    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

    S 1 Reply Last reply
    0
    • R 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

      S Offline
      S Offline
      Sir Dot Net
      wrote on last edited by
      #2

      Check out this article: Stream Operation in WCF[^]

      R 1 Reply Last reply
      0
      • S Sir Dot Net

        Check out this article: Stream Operation in WCF[^]

        R Offline
        R Offline
        ramzg
        wrote on last edited by
        #3

        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>

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups