WCF不超时是否正确? [英] WCF Not Timing out correctly?

查看:376
本文介绍了WCF不超时是否正确?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个超时问题,这些都是细节:

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>

我发送消息给我知道被关闭,以便连接应该只是超时后3秒的规定在我的app.config一台服务器,但由于某种原因它正在20-30秒。

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.

在EndPointNotFoundException被抛出,这是我得到的信息:

When the EndPointNotFoundException is thrown this is the info I get:

System.ServiceModel.EndPointNotFoundException:   无法连接到   的net.tcp://10.0.0.82:4466 / MegaMatcherWcf。   连接尝试持续了   的00:00:03时间跨度。 TCP错误code   10060:A连接尝试失败   因为连接的方没有   一段时间后,正确地响应   时间,或已建立的连接失败   因为连接主机未能   响应10.0.0.82:4466

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

如果我试着相同的测试用机打开,但没有听软件的运行,我得到预期的行为,与连接超时后3秒。为什么当机器关闭时它需要30秒,然后告诉我它花了3秒了吗?

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?

推荐答案

我相信你是在处理与Windows超时问题,现在,不是你的WCF超时。 Windows将需要20-30秒,以确定一台机器没有响应网络上。当你让你的调用WCF服务器时,Windows首先要建立一个路由到服务器。如果不能,它会提醒你的软件和软件认为它已经达到了自己的超时。你的系统永远不会真正投票的角度看,如果该服务正在运行,因为Windows仍然在试图找到一些在该IP地址的另一端。

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.

这篇关于WCF不超时是否正确?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆