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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:15:57+00:00 2026-05-12T09:15:57+00:00

I have a client-server application, which communicates using WCF, and uses NetDataContractSerializer to serialize

  • 0

I have a client-server application, which communicates using WCF, and uses NetDataContractSerializer to serialize the objects graph.

Since a lot of data is transferred between the server and the client, I tried to decrease its size by fine tuning the size of the data members (e.g. changed int to short, long to int, etc.).

After finishing the tuning, I found out, that the amount of transferred data hasn’t changed!
The problem is, that the NetDataContractSerializer serializes the objects graph to XML, so no matter what’s the size of the data-member, the only thing that matters is the size of its value. For example, the value 10023 of a Int16 data member will be serialized as the string “10023” (0x3130303233), instead of just 10023 (0x2727).

I remember that in Remoting I could use the BinaryFormatter which serialized the values according to the type of the data member, but I don’t know if it’s possible to use it with WCF.

Does someone have a solution?

  • 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-12T09:15:58+00:00Added an answer on May 12, 2026 at 9:15 am

    WCF uses SOAP messages, but what kind of message encoding is used, is totally up to you.

    Basically, out of the box, you have two: text encoding (text representation of XML message) or binary encoding. You can write your own message encoding, if you really must and need to.

    Out of the box, the basicHttp and wsHttp bindings use text encoding – but you can change that if you want to. The netTcp binding (which is the clear preferred choice behind corporate firewalls) will use binary by default.

    You can also define (just in config) your own “binary http” protocol, if you wish:

       <bindings>
          <customBinding>
            <binding name="BinaryHttpBinding">
              <binaryMessageEncoding />
              <httpTransport />
            </binding>
          </customBinding>
        </bindings>
    

    and then use it in your service and client side config:

       <services>
          <service name="YourService">
            <endpoint
              address="http://localhost:8888/YourService/"
              binding="customBinding"
              bindingConfiguration="BinaryHttpBinding"
              contract="IYourService"
              name="YourService" />
          </service>
        </services>
    

    Now you have a http-based transport protocol, which will encode your message in compact binary, for you to use and enjoy!

    No additional coding or messy hacks or lots of manual XML serialization code needed – just plug it together and use it! Ah, the joy of WCF flexibility!

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

Sidebar

Ask A Question

Stats

  • Questions 187k
  • Answers 187k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer That's because the index is not available when using the… May 12, 2026 at 5:26 pm
  • Editorial Team
    Editorial Team added an answer This also works: import sys def applejuice(q): func_name = sys._getframe().f_code.co_name… May 12, 2026 at 5:26 pm
  • Editorial Team
    Editorial Team added an answer Gmail strips out background images. Unfortunately, with HTML e-mail, you're… May 12, 2026 at 5:26 pm

Related Questions

I have a client/server style application which communicates using WCF which all works great.
I have a client-server application, in which the client communicates with the server using
I was hoping to implement a simple XMPP server in Java. What I need
I have a small business that sells website solutions to clients. The websites serve

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.