Dynamically changing WCF sendTimeout

Posted on 2009-12-17
Last Modified: 2013-11-12

My client proxy is generated using a configuration file.  For most operations in my WCF service the deafault sendTimeout of 1 minute is sufficient.  However, I need to increase this for one particular operation.

I try to change this programmatically as follows:

_dstServiceProxy.ChannelFactory.Endpoint.Binding.SendTimeout = TimeSpan.FromMinutes(10);

but it has no effect - I get a TimeoutException.  I've checked out the SendTimeout value in the debugger and it has been set to the desired 10 minutes but it doesn't seem to have been accepted by the proxy.

Any ideas why this isn't working?
Question by:swilson33
    LVL 42

    Expert Comment

    LVL 1

    Author Comment


    Hi sedgwick,

    I don't the link you sent addresses the issue.

    When I set the sendTimeout in the configuration to 10 minutes to operation completes fine.  Problem is, 10 minutes causes all sorts of problems for other operations (for example, I'm using a custom validator so if the user enters the wrong username/password it sits for 10 minutes before returning).

    I need to be able to change the value of sendTimeout just for this one (lengthy) operation.

    LVL 1

    Accepted Solution


    I got the desired effect using the following:

     _dstServiceProxy.InnerChannel.OperationTimeout = TimeSpan.FromMinutes(10);

    This appears to work OK, i.e. I do not get a timeout from my lengthy operation when this has been set.  When the operation has finished I set the OperationTimout back to a minute.

    I've tried to find a description on OperationTimout and how it differes from other timeouts (namely sendTimeout) but I've struggled to find anything.

    This leads to the following questions:

    1)  Is changing the OperationTimout on the client OK?
    2)  What exactly is OperationTimout and how does it differ to SendTimeout (from what information I have managed to find, it suggested that SendTimeout sets the OperationTimout? I'm very confused!)

    Many thanks.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
    As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now