Service timeout

Jul 31, 2014 at 5:57 PM
Hi,

I received a service timeout error on the hosted services, however, I cannot find where I can set the receive timeout configuration.

The MessageSize has already been set to Large:
ServiceGarden.AddServiceHostNetTcp(type, interfaceType, "I" + type.Name, MessageSize.Large);

Kind Regards,
Nishzone
Coordinator
Aug 1, 2014 at 8:18 AM
Hello!

You should be able to configure your services using standard WCF settings. All our settings are just additional simplifications.

Another way is to use the events the objects fire. For instance, the ServiceGarden object has a BeforeEndpointAdded and BeforeHostAdded event, which gives you access to these objects programmatically, so you can change all the properties you would like to change. Similarly, the ServiceClient object also has such events.


Markus
Aug 4, 2014 at 5:36 AM
Hi Markus,

The service events are very useful. Thank you.

While testing, I faced the issue that the bytes returned is larger than MessageSize.Large (100 MB).

I have modified the MaxMessageSize in the BeforeHostAdded event on the service side.
   private void ServiceGarden_BeforeHostAdded(object sender, HostAddedEventArgs e)
        {
            var binding = (NetTcpBinding)e.Binding;
            binding.MaxBufferPoolSize = 2147483647;
            binding.MaxBufferSize = 2147483647;
            binding.MaxReceivedMessageSize = 2147483647;
        }
However, the only event on the ServiceClient side is BeforeChannelOpens and I cannot find where to change the MessageSize limit beyond 100 MB.

Regards,
Nishzone
Coordinator
Aug 11, 2014 at 3:02 PM
Edited Aug 11, 2014 at 3:03 PM
Hello!

There are a few more settings that go with that, actually. Here's the actual code that runs by default:
            if (messageSize == MessageSize.Medium)
            {
                binding.MaxBufferSize = 1024 * 1024 * 10; // 10MB
                binding.MaxBufferPoolSize = binding.MaxBufferSize;
                binding.MaxReceivedMessageSize = binding.MaxBufferSize;
                binding.ReaderQuotas.MaxArrayLength = binding.MaxBufferSize;
                binding.ReaderQuotas.MaxStringContentLength = binding.MaxBufferSize;
            }
            else if (messageSize == MessageSize.Large)
            {
                binding.MaxBufferSize = 1024 * 1024 * 100; // 100MB
                binding.MaxBufferPoolSize = binding.MaxBufferSize;
                binding.MaxReceivedMessageSize = binding.MaxBufferSize;
                binding.ReaderQuotas.MaxArrayLength = binding.MaxBufferSize;
                binding.ReaderQuotas.MaxStringContentLength = binding.MaxBufferSize;
            }
On a side-note: I am not entirely certain that sending anything larger than 100MB over a single request is necessarily a good idea. That might not work well just from a plain service point-of-view.


Markus