Monotouch / WCF: why can't you override wcf binding timeout setting

Monotouch / WCF: why can't you override the bind wcf binding timeout setting:

public class MyServiceClient : ClientBase<IMyContract>,IMyContract
{ ... }

public void test() {
        BasicHttpBinding basicHttpBinding = new BasicHttpBinding();
        basicHttpBinding.Name = "basicHttpBinding";
        basicHttpBinding.MaxBufferSize = int.MaxValue;
        basicHttpBinding.MaxReceivedMessageSize = int.MaxValue;
        basicHttpBinding.ReceiveTimeout = TimeSpan.FromSeconds(10.0);
        basicHttpBinding.SendTimeout = TimeSpan.FromSeconds(10.0);
        basicHttpBinding.CloseTimeout = TimeSpan.FromSeconds(5.0);
        basicHttpBinding.OpenTimeout = TimeSpan.FromSeconds(5.0);

       MyServiceClient client = New MyServiceClient(basicHttpBinding, new EndPointAddress(...));
       client.Test();
     }

      

// Although I set OpenTimeout to 5 seconds, but when I shut down the server service (or shut down the wifi and iphone network), it still tries to connect to the service in the background until the default timeout of 1, that's weird! What for? thank.

btw, exception in monotouch / iPhone is thrown after 1 minute, type is TimeoutException (message: Operation has timed out.), not FaultException or CommunicationException). If the above code is called on a windows.net client, it should throw CommunicationException.

+3


source to share


1 answer


Xamarin command response: serviceClient.innerchannel.operationtimeout = ... Thanks.



+8


source







All Articles