Hi,
As i read this article and learnt how timeout can be reset -
I'd like to know whether it is possible to customize the settings programmatically within different scope? For instance,
TimeSpan originalTimeOut = endpoint.Binding.SendTimeout;
try
{
{// scope 1, for operation 1
endpoint.Binding.SendTimeout = timeoutBigVal;
DoSomeWorkThatTakesVeryLong();
}
{// scope 2, for operation 2
endpoint.Binding.SendTimeout = timeoutSmallVal;
DoSomeOtherWorkNotVeryTimeConsuming();
}
}
finally
{// then set back for all other methods to go as usual
endpoint.Binding.SendTimeout = originalTimeOut;
}
Also, I'd like to confirm this behavior because I noticed that setting "endpoint.Binding.SendTimeout" in code(CustomServiceProxyEvents:OnEndpointCreated) is not the equivalent to setting only the SendTimeout ="<value>" in config file. Because the former worked for my simulation but the later failed with an exception about "client channel timeout". So internally this SendTimeout for the binding in code will overwrite the different operationTime of client channel too? Please explain. Thanks a lot!