c# - WCF Timeouts larger than configured -
i have configured wcf these timeouts:
public static nettcpbinding maketcpbinding(bool isclient) { return new nettcpbinding(securitymode.none, false) { hostnamecomparisonmode = hostnamecomparisonmode.strongwildcard, transactionflow = false, portsharingenabled = true, security = {transport = {clientcredentialtype = tcpclientcredentialtype.none}}, receivetimeout = isclient ? timespan.fromseconds(5) : timespan.fromdays(1), sendtimeout = isclient ? timespan.fromseconds(1) : timespan.fromseconds(5), opentimeout = timespan.fromseconds(1), closetimeout = timespan.fromseconds(5), maxreceivedmessagesize = int.maxvalue, listenbacklog = int.maxvalue, maxbuffersize = int.maxvalue, maxbufferpoolsize = 524288, readerquotas = { maxarraylength = int.maxvalue, maxstringcontentlength = int.maxvalue, maxdepth = int.maxvalue, maxbytesperread = int.maxvalue, maxnametablecharcount = int.maxvalue } }; }
which should set imeout 1 second when client connects non-existing server.
however, when calling open, see 21 second timeout.
debug 2013-07-31 18:12:44,712 communication.wcfcommunicator - notifyallreceivers: type: askwhoisawake, sentdate: 7/31/2013 18:12:44 am, detectsessionid: 37106dee-b563-458b-9eb7-a90e81f82563 - 1
debug 2013-07-31 18:13:05,746 communication.wcfcommunicator - not connect net.tcp://notup/xxx.svc/motup_www-xxx-com. connection attempt lasted time span of 00:00:00.9879988. tcp error code 10060: connection attempt failed because connected party did not respond after period of time, or established connection failed because connected host has failed respond 42.42.42.42:808. - 6
what causing 20 second timeout?
solved using async open , setting timeout.
var ar = client.innerchannel.beginopen(null, null); if (!ar.asyncwaithandle.waitone(client.endpoint.binding.opentimeout, true)) throw new communicationexception("service not available"); client.innerchannel.endopen(ar);
Comments
Post a Comment