Print Page | Close Window

Custom ServiceProxyEvents for setting Timeout

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3346
Printed Date: 24-Apr-2024 at 3:32am


Topic: Custom ServiceProxyEvents for setting Timeout
Posted By: viola
Subject: Custom ServiceProxyEvents for setting Timeout
Date Posted: 19-Mar-2012 at 11:32pm
Hi,
 
As i read this article and learnt how timeout can be reset -
http://drc.ideablade.com/xwiki/bin/view/Documentation/code-sample-custom-client-configuration - http://drc.ideablade.com/xwiki/bin/view/Documentation/code-sample-custom-client-configuration
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! 



Replies:
Posted By: sbelini
Date Posted: 20-Mar-2012 at 11:34am
Hi Viola,
 
What version of DevForce are you using?
 
Regards,
   Silvio.


Posted By: viola
Date Posted: 20-Mar-2012 at 7:26pm
The latest, 6.1.6.


Posted By: sbelini
Date Posted: 22-Mar-2012 at 4:38pm
Hi viola,
 
Apparently, after the binding is used your changed configurations will not take any effect. ( http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/b851a558-0afd-4dfb-b9cf-941668868828/ - http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/b851a558-0afd-4dfb-b9cf-941668868828/ )
 
For the second issue you described, can you clarify? What is the full exception message you are getting?
 
Also, there is a topic in the http://drc.ideablade.com/xwiki/bin/view/Documentation/understand-timeouts - DevForce Resource Center that explains how to handle timeouts.
 
Regards,
   Silvio.



Print Page | Close Window