There are a number of timeout settings available in WCF bindings. Setting these timeout settings correctly can improve not only your service’s performance but also play a role in the usability and security of your service. The following timeouts are available on WCF bindings:
- OpenTimeout
- CloseTimeout
- SendTimeout
- ReceiveTimeout
Open Timeout : This property represents the amount of time a channel open operation has to complete.
Send Timeout : Use this property to set the amount of time that a send operation has to complete. When used as part of a solicit-response scenario, this value encompasses the total amount of time for the interaction to complete. If we are sending a large message, we may need to increase this timeout to allow for the request and response messages to be processed within this window.
Close Timeout : A time-stamp that is used to indicate the amount
Receive Timeout : Used by the Service Framework Layer to initialize the session-idle timeout which controls how long a session can be idle before timing out.
Following are C#, Config and BizTalk e.g. :
C#
- public static void Main()
- {
- Uri baseAddress = new Uri("http://localhost/BizTalkLive/BizTalkService");
- try
- {
- ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService));
- WSHttpBinding binding = new WSHttpBinding();
- binding.OpenTimeout = new TimeSpan(0, 10, 0);
- binding.CloseTimeout = new TimeSpan(0, 10, 0);
- binding.SendTimeout = new TimeSpan(0, 10, 0);
- binding.ReceiveTimeout = new TimeSpan(0, 10, 0);
- serviceHost.AddServiceEndpoint("ICalculator", binding, baseAddress);
- serviceHost.Open();
- // The service can now be accessed.
- Console.WriteLine("The service is ready.");
- Console.WriteLine("Press <ENTER> to terminate service.");
- Console.WriteLine();
- Console.ReadLine();
- }
- catch (CommunicationException ex)
- {
- // Handle exception ...
- }
- }
Config
- <configuration>
- <system.serviceModel>
- <bindings>
- <wsHttpBinding>
- <binding openTimeout="00:01:00"
- closeTimeout="00:01:00"
- sendTimeout="00:01:00"
- receiveTimeout="00:10:00">
- </binding>
- </wsHttpBinding>
- </bindings>
- </system.serviceModel>
BizTalk Console
Client-side Timeouts:
Used: SendTimeout, OpenTimeout, CloseTimeout
Not Use: ReceiveTimeout
Service-side Timeouts: SendTimeout, OpentTimeout, CloseTimeout are the same as on the client-side except ReceiveTimeout.
!! Keep visiting BizTalkLive !!
Please write your comment in English language only !
ReplyDeleteThis is very nice blog,and it is helps for student's.Thanks for info
ReplyDeleteBiztalk onlinecourse Bangalore
nice blog goof info
ReplyDeletebiztalk training for beginers
How can i set timeout property dynamically(From Message Content ) in WCF-WebHttp adapter without using Orchestration
ReplyDeleteExcellent Blog, I like your blog and It is very informative. Thank you
ReplyDeleteProgramming Language
PHP