Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6614917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:23:50+00:00 2026-05-25T20:23:50+00:00

I am planning to pass MemoryStream via WCF Streaming but it seems not working

  • 0

I am planning to pass MemoryStream via WCF Streaming but it seems not working but when I slightly change the code to pass FileStream instead, it is working. In fact, my purpose is to pass large collection of business objects (serializable). I am using basicHttpBinding. Your suggestion would be much appreciated!

Edited:
The symptoms of the issue is that the incoming stream is empty. There is neither error nor exception.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:23:51+00:00Added an answer on May 25, 2026 at 8:23 pm

    You’re not providing many details, however, I’m almost certain I know what the issue is as I’ve seen that happening a lot.

    If you write something to a MemoryStream in order to return that one as the result of a WCF service operation, you need to manually reset the stream to its beginning before returning it. WCF will only read the stream from it current position, hence will return an empty stream if that position hasn’t been reset.

    That would at least explain the problem you’re describing. Hope this helps.

    Here some sample code:

        [OperationContract]
        public Stream GetSomeData()
        {
            var stream = new MemoryStream();
            using(var file = File.OpenRead("path"))
            {
                // write something to the stream:
                file.CopyTo(stream);         
                // here, the MemoryStream is positioned at its end
            }
            // This is the crucial part:
            stream.Position = 0L;
            return stream;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am planning to develop a very simple java application (not mobile, but desktop
Iam planning to create an app, and not to publish it at the google
My current class is planning on creating a basic networked game, but we have
Does anybody know if Microsoft is planning on having IE9 pass with 100/100 on
I am planning to use jQuery Autocomplete (Not UI Autocomplete) plugin to fetch data
Is there a way to pass a newly created object(not saved yet) to another
Planning of using t4 template in a production environment. I have not used this
I am planning to use EJBContext to pass some properties around from the application
I'm planning on creating wrappers for my WCF client which encapsulate calls to a
Am planning to use cookies to communicate between two browser windows. Am wondering if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.