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

  • Home
  • SEARCH
  • 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 6542041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:10:40+00:00 2026-05-25T11:10:40+00:00

Ive got a WCF service that returns content-type ‘application/x-gzip’ which essentially appears to be

  • 0

Ive got a WCF service that returns content-type ‘application/x-gzip’ which essentially appears to be XML/Json that is compressed using Gzip. I implemented a GzipMessageEncoder and CustomBinding as described at the following link by Carlos Figueira:

http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/8c3eafae-b6a1-441f-85ef-90721d941a1a

For the data that my service returns I’m using a basic grid concept w/ JSON that splits up the schema and uses a string[] for each row to keep things compact:

[DataContract]
[KnownType(typeof(JsonContract))]
[KnownType(typeof(ColumnDefinition))]
public class JsonContract
{
    [DataMember]
    public List<ColumnDefinition> Schema { get; set; }

    [DataMember]
    public List<String[]> Rows { get; set; }
}

public class Service : IGzipTest
{
    public JsonContract HttpRequest() 
    {
        // return json data
    }
}

The Gzip is working fine but I think the performance on my client is slow / inconsistent, using ChannelFactory:

    private ChannelFactory<T> CreateFactory<T>(CustomBinding binding, string endpoint)
    {
        EndpointAddress _endpoint = new EndpointAddress(endpoint);
        ChannelFactory<T> _factory = new ChannelFactory<T>(binding, _endpoint);

        _factory.Endpoint.Behaviors.Add(new WebHttpBehavior());

        return _factory;
    }

Here is how I start the service:

    static string baseAddress = "http://" + Dns.GetHostName() + ":4050/ZipTest";
    static ServiceHost host = new ServiceHost(typeof(Service), new Uri(baseAddress));

    protected void Application_Start(object sender, EventArgs e)
    {
        ThreadPool.SetMinThreads(Environment.ProcessorCount, 9); 

        host.AddServiceEndpoint(typeof(IGzipTest), 
            GzipMapper.GetBinding(), "").Behaviors.Add(new WebHttpBehavior()); 

        host.Open();
    }

When downloading ~512kb to ~1mb of data (thats after compression), these are my performance results on seperate consecutive tests:

   1st Request: 4439ms
   2nd Request: 19029ms

   ..and so on

It seems that every other call to the service takes about 4-5 times as long. Even 4000 ms seems long for only 512kb to 1mb of data, so I’m wondering what could be wrong.

For instance if I download the .gz file itself from a browser using a [WebGet] decorated method it only takes a second at most because I am hitting 400-500kb/s at worst.

  • 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-25T11:10:41+00:00Added an answer on May 25, 2026 at 11:10 am

    I have seen similar fluctuations, and they were caused, at least that’s what I’m currently thinking, by excessive memory use of GzipMessageEncoder and buffered TransferMode, which is the default. Buffered TransferMode uses BufferManagers, which can lead to severe memory issues and were causing OutOfMemoryExceptions for me.

    Whatever the exact reasons, I fixed that and also vastly reduced memory consumption and cpu load of both servers and clients by

    1. Getting rid of GzipMessageEncoder, see wcf conditional compression
    2. Changing to streamed TransferMode, see How can I prevent BufferManager / PooledBufferManager in my WCF client app from wasting memory?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a WCF service that I'm hosting in IIS 7, which I connect
I've got a method on a WCF service that returns an ObservableCollection<T> . On
I've got a WCF service that stories media files and returns them to consuming
I've got a REST-ful WCF service that returns back an XML response. It is
I've got a WCF service that offers a Login method. A client is required
I've got a WCF service which handles some sensitive data. I'd like to make
I've got an app which is using a WCF service. Now I'd like to
I've got a hosted WCF service that I created a custom factory for, so
I've got a WCF service (basicHttpBinding, basic authentication, IIS 6.0) on which I want
I've got a WPF windows client that calls a WCF web service. The user

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.