3

I'm struggling with setting the OperationTimeout on the RoutingService

The issue is that the service to which the message is forwarded needs more then 1 Minute to give a response. This causes an OperationTimeout Exception on the RoutingService.

I tried to set the OperationTimeout on the client proxy of the RoutingService without success.

What I did, is to add an Endpoint Behavior and add in the ApplyClientBehavior method an custom IClientMessageInspector.

In the custom ClientMessageInspector I set the OperationTimeout, like you see in this code snippet.

 public object BeforeSendRequest(ref Message request, IClientChannel channel) { var contextChannel = channel as IContextChannel; contextChannel.OperationTimeout = new TimeSpan(0, 10, 0); return request; } 

For me it seems that I'm too late at this point and therefore the RoutingService generated proxy doesn't care about this setting, could this be ?

Any suggestions?

1
  • You don't need to include signature in your post - your user card is added automatically. Read FAQ for more details. Commented Dec 17, 2012 at 16:22

2 Answers 2

1

I found a solution how to solve this.

You just need to set the SendTimeout on the binding of the client endpoint of the router. When creating the proxy the router will set OperationTimeout=SendTimeout on it's channel.

 // add the endpoint the router uses to receive messages serviceHost.AddServiceEndpoint( typeof(IRequestReplyRouter), new BasicHttpBinding(), "http://localhost:8000/routingservice/router"); // create the client endpoint the router routes messages to var client = new ServiceEndpoint( ContractDescription.GetContract(typeof(IRequestReplyRouter)), new NetTcpBinding(), new EndpointAddress("net.tcp://localhost:8008/MyBackendService.svc")); // Set SendTimeout, this will be used from the router generated proxy as OperationTimeout client.Binding.SendTimeout = new TimeSpan(0, 10, 0); 
Sign up to request clarification or add additional context in comments.

Comments

1

In web.config set SendTimeout in the below

<binding name="myBindingName" sendTimeout="00:10:00" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" crossDomainScriptAccessEnabled="true" /> 

1 Comment

I down-voted this post because while it works, it's very imprecise. See stackoverflow.com/a/5310933/249742 for details about timeouts used client side: in that case, the only timeout to change is sendTimeout.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.