Welcome to MSDN Blogs Sign in | Join | Help

Syndication

News

Indigo
This posting is provided "AS IS"
with no warranties,
and confers no rights.

Timeouts and WCF - httpRuntime

There seems to be very little documentation around the timeout behaviors for the client and service and configuring so many knobs can get you in a fix if you dont know what you are tweaking. The below snippet shows how enable one of these scenarios to keep connections open for long processing message. Bad as it sounds this might be required if we are designing a synchonour system with large processing times per service.

The underlying fact is that in v1 of WCF there is more than the knobs.
The underlying httpRuntime is also responsible for the connection and this knob also needs to be set to accept long calls and large execution times.

<system.web>
    <
httpRuntime executionTimeout="400000"/>
</
system.web>

The next setting required to be done is on the client. We also need t specify the sendTimeout if we know that the send process is going to take a while.

            ChannelFactory<ServiceReference.IService1> cf = new ChannelFactory<Client.ServiceReference.IService1>("BasicHttpBinding_IService1");

            BasicHttpBinding b = (cf.Endpoint.Binding as BasicHttpBinding);

            b.SendTimeout = new TimeSpan(0,6,10);

           

            IService1 proxy = cf.CreateChannel();           

            try

            {

                Console.WriteLine(proxy.GetData(6));

                Console.ReadLine();

            }

            finally

            {

                if((proxy as IChannel).State == CommunicationState.Opened)

                    (proxy as IChannel).Close();

            }

 

Published Tuesday, July 24, 2007 1:42 PM by Sajay

Filed under: ,

Comments

# Better Basketball &raquo; Timeouts and WCF - httpRuntime @ Saturday, April 19, 2008 10:52 PM

PingBack from http://www.basketballs-sports.info/better-basketball/?p=468

Better Basketball &raquo; Timeouts and WCF - httpRuntime

Anonymous comments are disabled
Page view tracker