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?