WCF endpoint binding settings don't get updated

All attempts to change configuration settings of WCF self hosted service endpoint fail:

public void Start()
    {
        BasicHttpBinding binding = new BasicHttpBinding();
        binding.Name = "NAVBinding";
//--------------------START editing-------------------------------
        TimeSpan interval = new TimeSpan(1, 50, 00); // all these following (inbetween comments) lines have no effect
        binding.MaxReceivedMessageSize = 2147483647;
        binding.MaxBufferSize = 2147483647;
        binding.ReceiveTimeout = interval;
        binding.OpenTimeout = interval;
        binding.CloseTimeout = interval;
        binding.SendTimeout = interval;
        XmlDictionaryReaderQuotas readerQuotas = new XmlDictionaryReaderQuotas();
        readerQuotas.MaxDepth = 2147483647;
        readerQuotas.MaxStringContentLength = 2147483647;
        readerQuotas.MaxArrayLength = 2147483647;
        readerQuotas.MaxBytesPerRead = 2147483647;
        readerQuotas.MaxNameTableCharCount = 2147483647;
        binding.ReaderQuotas = readerQuotas;
//----------------------END editing---------------------------
        binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
        Uri baseAddress = new Uri("http://localhost:8000/nav/customer");
        Customer_Service service = new Customer_Service();
        serviceHost = new ServiceHost(service, baseAddress);
        serviceHost.AddServiceEndpoint(typeof(ICustomer_Service), binding, baseAddress);
        OpenMetadataExchange(baseAddress);
        service.navEventListner = this;
        serviceHost.Open();

    }

but I can easily change the MaxReceivedMessageSize property with the help of wcfStorm application and in this case it really is changed. But after restarting service, everything gets back to its default settings (for example MaxReceivedMessageSize = 65536).

Please, what am I doing whrong? How to edit my code in order new values get updated?

Answers


Setting those values on the SERVER SIDE does not automagically set them on the CLIENT SIDE.

Only setting them on the server side is not enough - the transfer between client and server is dictated by the smallest of the two settings between client and server. Even if the server allows 2 GB of message size, if the client still insists on 64 KB, the smaller value of 64 KB wins. That doesn't mean the 2 GB setting on the server side isn't there - it is, but it's not being effective because the client uses a smaller setting.

If you want to use the same settings on the client side, you will need to configure the client side accordingly. You will need to do the same thing when creating your client proxy, or configure your client from an app.config file.


Need Your Help

IN MATLAB: How to plot a graph every 3 lines from a Text file?

matlab file graph plot repeat

I have a large text file with 2 columns where the values are separated by commas. I am trying to create a simple program which allows to plot a graph with the data extracted for every 3 rows

Is it possible to run ASP.NET MVC routes in different AppDomains?

asp.net-mvc url-routing appdomain global-asax

I am having problems with thinking up a solution for the following. I got a blog which I recently upgraded from web forms to MVC. The blog is avalible in both swedish and english on two different d...