I am having a timeout issue, these are the details:
My binding configuration looks like this:
<netTcpBinding>
<binding name="WindowsServerOverTcp"
maxReceivedMessageSize="10000000"
maxBufferSize="10000000"
maxBufferPoolSize="10000000"
closeTimeout="00:00:03"
openTimeout="00:00:03"
sendTimeout="00:00:03"
receiveTimeout="00:00:03">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
<security mode="None">
</security>
</binding>
</netTcpBinding>
I am sending a message to a server which I know is turned off so the connection should just time out after 3 seconds as stipulated in my app.config, but for some reason it is taking 20-30 seconds.
When the EndPointNotFoundException is thrown this is the info I get:
System.ServiceModel.EndPointNotFoundException:
Could not connect to
net.tcp://10.0.0.82:4466/MegaMatcherWcf.
The connection attempt lasted for a
time span of 00:00:03. TCP error code
10060: A connection attempt failed
because the connected party did not
properly respond after a period of
time, or established connection failed
because connected host has failed to
respond 10.0.0.82:4466
If I try the same test with the machine turned on, but no listening software running I get the expected behaviour, with the connection timing out after 3 seconds. Why if the machine is off does it take 30 seconds, and then tell me it took 3 seconds?
I believe you are dealing with a Windows timeout issue now, not your WCF timeout. Windows will take 20-30 seconds to determine that a machine is not responding on the network. When you make your call to the WCF server, Windows first has to establish a route to the server. When it can’t, it alerts your software and your software thinks that it reached its own timeout. Your system never gets to the point of actually polling to see if the service is running because Windows is still trying to find something at the other end of that IP address.