I\'m using WCF in communication between a server and client (both written in C#).
In release-mode, the timouts should be set to ~20 seconds, but in debug mode I want to
You could do the following:
Something like:
BasicHttpBinding myBinding = new BasicHttpBinding("ConfigName");
myBinding.CloseTimeout = .......
myBinding.OpenTimeout = .......
myBinding.ReceiveTimeout = .......
myBinding.SendTimeout = .......
EndpointAddress myEndpoint = new EndpointAddress("http://server:8181/yourservice");
YourServiceClient proxy = new YourServiceClient(myBinding, myEndpoint);
That way, you can leverage the basic config when describing binding timeouts and yet you can tweak the settings you want and create your client proxy from it.
You can create a second binding in the web.config and set a longer sendTimeout.
if (debug)
{
proxy = new MyClient("WSHttpBinding_MyLocal");
}
else
{
proxy = new MyClient("WSHttpBinding_MyDev");
}
<wsHttpBinding>
<binding name="WSHttpBinding_MyLocal" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:20:00"
...