• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 907
  • Last Modified:

Dynamically changing WCF sendTimeout


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?
0
swilson33
Asked:
swilson33
  • 2
1 Solution
 
swilson33Author Commented:

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.

Thanks.
0
 
swilson33Author Commented:
UPDATE:

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.
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now