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 341831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:44:43+00:00 2026-05-12T10:44:43+00:00

this if my first attempt at using streaming for WCF, and I am struggling

  • 0

this if my first attempt at using streaming for WCF, and I am struggling with the dreadful “The remote server returned an unexpected response: (400) Bad Request” response.

The trace viewer says that this is a System.ServiceModel.ProtocolException with message “There is a problem with the XML that was received from the network. See inner exception for more details.” The inner exception type says “The body of the message cannot be read because it is empty.“

Leaving everything else equal, if I switch to buffered mode on the client side, I am able to debug into the server code!

For some reason, I have to configure my service programmatically, as follows:

    public IUniverseFileService OpenProxy(string serviceUrl)
    {
        Debug.Assert(!string.IsNullOrEmpty(serviceUrl));

        var binding = new BasicHttpBinding();
        binding.Name = "basicHttpStream";
        binding.MaxReceivedMessageSize = 1000000;
        binding.TransferMode = TransferMode.Streamed;

        var channelFactory = 
           new ChannelFactory<localhost.IUniverseFileService>(
              binding, 
              new EndpointAddress(serviceUrl));

        return channelFactory.CreateChannel();
    }

While the server is configured as follows:

 <system.serviceModel>
    <!-- BEHAVIORS -->
    <behaviors>
      <serviceBehaviors>
        <behavior name="serviceBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true" httpHelpPageEnabled="true"/>
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <!-- SERVICES -->
    <services>
      <service behaviorConfiguration="serviceBehavior" name="Org.Acme.UniverseFileService">
        <endpoint address="" 
                  binding="basicHttpBinding" 
                  name="basicHttpStream" 
                  bindingConfiguration="httpLargeMessageStream"
                  contract="Org.Acme.RemoteCommand.Service.IUniverseFileService" /> 
        <endpoint address="mex" 
                  binding="mexHttpBinding" 
                  bindingConfiguration="" name="mexStream" 
                  contract="IMetadataExchange"/>
      </service>
    </services>
    <!-- BINDINGS -->
    <bindings>
      <basicHttpBinding>
        <binding name="httpLargeMessageStream" 
                 maxReceivedMessageSize="2147483647" 
                 maxBufferPoolSize="2147483647"
                 maxBufferSize="2147483647" 
                 transferMode="Streamed"/>
      </basicHttpBinding>
    </bindings>

I appreciate your help!

Stefano

  • 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-12T10:44:43+00:00Added an answer on May 12, 2026 at 10:44 am

    Everything started to work when I changed the transfer mode from Streamed to StreamedResponse as follows:

    binding.TransferMode = TransferMode.StreamedResponse;
    

    Still I don’t understand why this works and Streamed does not, and why I am able to both send and receive a file stream from the server.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my first attempt at using JSCookMenu and its homepage ( http://jscook.yuanheng.org/JSCookMenu/ )
Although I am not new to Python, this is my first attempt at using
This is my first attempt at updating a database using LINQtoSQL. At least, it's
This is my first attempt at using Backbone.js, so I decided to make a
I'm using Visual Web Developer 2010 Express. This is my first attempt at creating
This is my first real attempt at using multithreading, I want to know how
This is my first experience using the Zend Framework. I am attempting to follow
This is my first time using joomla. I don't know if I'm using the
This is my first-attempt at writing anything even slightly complicated in C++, I'm attempting
In my first attempt at using NSExpression in a fetch request, I’m getting a

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.