随机无法连接到本地主机的Web服务器

我们有一个很奇怪的问题,几个星期前就出现了,而且一直没能解决。

我们在IIS(端口80,443)和Apache(8080,8090)中都运行同一台Windows Server 2003 SP2计算机上的几个网站。 我们现在已经运行了这个configuration几年了。

运行在IIS连接中的Web应用程序有时会连接到Apache中运行的应用程序(在同一台服务器上),然后再响应客户端。 其他时候,应用程序将连接到另一台服务器上运行的数据库服务器,有时它们也将连接到另一台服务器上的Windows文件共享。

在上述三种情况下,我们都会偶尔报告以下错误之一:

  • 无法从传输连接读取数据:build立的连接被主机中的软件中止。
  • 底层连接已closures:接收时发生意外错误。

另外,我们注意到在问题发生的时候login到服务器,试图请求http:// localhost / etc , http: //127.0.0.1/etc,http : //192.168.xxx .xxx / etc (本地IP)都会给出“Connection was reset”错误信息(Firefox)。 IIS和Apache Web请求均失败。 我们可以从不同的机器(使用IP地址或主机名)连接到服务器,我们可以从服务器连接到外部站点,并且在这段时间内对自身进行ping操作不会退出。

这个问题会奇迹般地纠正自己一段随机的时间。 有时我们可以在24小时内解决问题,其他时间只需20-30分钟。 发生问题时,可以持续几秒到几分钟(通常不超过10-15分钟)。

在我们从服务器体验到数据库服务器或文件共享服务器的时候,我们也没有遇到任何问题。

任何想法,我们应该在哪里看?

更新:所以我们仍然在这个领域,但是为了增加更多的细节,我们在连接到多个服务器和几个不同types的连接时随机地得到这些错误。 我们可以通过cifs(文件共享),SQL Server和networking连接到局域网和广域网上的多个服务器,以及自己。 大部分时间是“build立的连接被主机中的软件中止”。

NETSH转储

#======================== # Interface configuration #======================== pushd interface reset all popd # End of interface configuration #======================== # Interface configuration #======================== pushd interface ipv6 uninstall popd # End of interface configuration # ---------------------------------- # ISATAP Configuration # ---------------------------------- pushd interface ipv6 isatap popd # End of ISATAP configuration # ---------------------------------- # 6to4 Configuration # ---------------------------------- pushd interface ipv6 6to4 reset popd # End of 6to4 configuration #======================== # Port Proxy configuration #======================== pushd interface portproxy reset popd # End of Port Proxy configuration # ---------------------------------- # Interface IP Configuration # ---------------------------------- pushd interface ip # Interface IP Configuration for "SW-1A" set address name="SW-1A" source=static addr=192.168.xxx.51 mask=255.255.255.0 add address name="SW-1A" addr=192.168.xxx.50 mask=255.255.255.0 set address name="SW-1A" gateway=192.168.xxx.254 gwmetric=0 set dns name="SW-1A" source=static addr=192.168.xxx.2 register=PRIMARY add dns name="SW-1A" addr=192.168.xxx.3 index=2 set wins name="SW-1A" source=static addr=none popd # End of interface IP configuration # ------------------------------------ # Bridge configuration (not supported) # ------------------------------------ # ------------------------------------ # End of Bridge configuration # ------------------------------------ # ----------------------------------------- # aaaa Configuration # ----------------------------------------- # This script will NOT work across different versions of IAS. # ----------------------------------------- # aaaa configuration script. # Known Issues and limitations: # Import/Export between different versions is not supported. # IAS.MDB Version = 7 pushd aaaa set config blob=\ blob snippped \ AA\ *\ A7ACI/wD\ \ *\ A7ACI/wD\ \ *\ A7ACI/wD\ \ *\ A7ACI/wD\ \ *\ A7ACI/wD\ \ *\ A7ACI/wD\ \ *\ A7ACI/wD\ \ *\ A7ACI/wD\ \ *\ A7ACI/wD\ \ *\ A7ACI/wD\ \ *\ A7ACI/wD\ \ *\ A7ACI/wD\ \ *\ A7ACI/wD\ \ *\ A7ACI/wD\ \ * popd # End of aaaa show config # End of aaaa configuration. # ----------------------------------------- # Remote Access Configuration # ----------------------------------------- pushd ras set authmode mode = standard delete authtype type = PAP delete authtype type = SPAP delete authtype type = MD5CHAP delete authtype type = MSCHAP delete authtype type = MSCHAPv2 delete authtype type = EAP add authtype type = MSCHAP add authtype type = MSCHAPv2 delete link type = SWC delete link type = LCP add link type = SWC add link type = LCP delete multilink type = MULTI delete multilink type = BACP add multilink type = MULTI add multilink type = BACP set user name = ASPNET dialin = policy cbpolicy = none set user name = Guest dialin = policy cbpolicy = none set user name = IUSR_WX-WWW1 dialin = policy cbpolicy = none set user name = IWAM_WX-WWW1 dialin = policy cbpolicy = none set user name = customuser1 dialin = policy cbpolicy = none set user name = customuser2 dialin = policy cbpolicy = none set user name = customuser3 dialin = policy cbpolicy = none set user name = SUPPORT_388945a0 dialin = policy cbpolicy = none set user name = customuser4 dialin = policy cbpolicy = none popd # End of Remote Access configuration. # ----------------------------------------- # Remote Access AppleTalk Configuration # ----------------------------------------- pushd ras appletalk set negotiation mode = allow popd # End of Remote Access AppleTalk Configuration. # ----------------------------------------- # Remote Access Diagnostics Configuration # ----------------------------------------- pushd ras diagnostics set rastracing component = * state = disabled set modemtracing state = disabled set cmtracing state = disabled set securityeventlogs state = disabled popd # End of Remote Access Diagnostics Configuration. # ----------------------------------------- # Remote Access IP Configuration # ----------------------------------------- pushd ras ip delete pool set negotiation mode = allow set access mode = all set addrreq mode = deny set broadcastnameresolution mode = disabled set addrassign method = auto popd # End of Remote Access IP configuration. # ----------------------------------------- # Remote Access IPX Configuration # ----------------------------------------- pushd ras ipx set negotiation mode = allow set access mode = all set nodereq mode = allow set netassign method = autosame popd # End of Remote Access IPX configuration. # ----------------------------------------- # Remote Access NBF Configuration # ----------------------------------------- pushd ras netbeui set negotiation mode = allow set access mode = all popd # End of Remote Access NBF configuration. # ----------------------------------------- # Remote Access AAAA Configuration # ----------------------------------------- pushd ras aaaa set authentication provider = windows set accounting provider = windows delete authserver name = * delete acctserver name = * popd # End of Remote Access AAAA configuration. # Routing Configuration pushd routing reset popd # IP Configuration pushd routing ip reset set loglevel error add preferenceforprotocol proto=LOCAL preflevel=1 add preferenceforprotocol proto=NetMgmt preflevel=10 add preferenceforprotocol proto=STATIC preflevel=3 add preferenceforprotocol proto=NONDOD preflevel=5 add preferenceforprotocol proto=AUTOSTATIC preflevel=7 add preferenceforprotocol proto=OSPF preflevel=110 add preferenceforprotocol proto=RIP preflevel=120 add interface name="SW-1B" state=enable set filter name="SW-1B" fragcheck=disable add interface name="SW-1A" state=enable set filter name="SW-1A" fragcheck=disable add interface name="Internal" state=enable set filter name="Internal" fragcheck=disable add interface name="Loopback" state=enable set filter name="Loopback" fragcheck=disable popd # End of IP configuration # ---------------------------------- # DNS Proxy configuration # ---------------------------------- pushd routing ip dnsproxy uninstall popd # End of DNS proxy configuration # ---------------------------------- # IGMP Configuration # ---------------------------------- pushd routing ip igmp uninstall popd # End of IGMP configuration # ---------------------------------- # NAT configuration # ---------------------------------- pushd routing ip nat uninstall popd # ---------------------------------- # OSPF configuration # ---------------------------------- pushd routing ip ospf uninstall popd # End of OSPF configuration # ---------------------------------- # DHCP Relay Agent configuration # ---------------------------------- pushd routing ip relay uninstall popd # End of DHCP Relay configuration # ---------------------------------- # RIP configuration # ---------------------------------- pushd routing ip rip uninstall popd # End of RIP configuration # ---------------------------------- # Router Discovery Configuration # ---------------------------------- pushd routing ip routerdiscovery uninstall add interface name="SW-1B" disc=disable minint=7 maxint=10 life=30 level=0 add interface name="SW-1A" disc=disable minint=7 maxint=10 life=30 level=0 add interface name="Internal" disc=disable minint=7 maxint=10 life=30 level=0 add interface name="Loopback" disc=disable minint=7 maxint=10 life=30 level=0 popd # ---------------------------------- # DHCP Allocator Configuration # ---------------------------------- pushd routing ip autodhcp uninstall popd # End of DHCP Allocator Configuration Loading of DLL WinsEvnt.dll failed. Wins Operation failed with Error There are no more endpoints available from the endpoint mapper. 

更新:我们最终在7月底在同一个硬件上安装了Windows Server 2008 R2,问题消失了,从此我们一直没有回头。 有一点你只是削减你的损失,咬紧了子弹,并与它运行。

一种可能性:短暂的港口枯竭。 试试像netstat -an | find /c ":" netstat -an | find /c ":"来计算你在各种状态下有多less连接。 如果这个数字超过一万,那么很有可能这是你的问题。

你在事件日志中看到有用的东西吗? 驱动程序在启动时是否有加载问题? 你能检查交换机,看看系统的上行接口是否有传输或校验和错误?

如果你在重新启动时遇到了与networking有关的错误,那么我会先find这些错误。 如果你有开关错误,我会更换电缆,并移动到交换机上的不同端口。

如果您没有错误,请考虑安装新的网卡。 在最好的情况下,它可以解决这个问题,最坏的情况是,随着新的电缆和一个不同的交换机端口,你可以完全脱离物理列表。

更新

鉴于这是发生在多台机器上,我认为我们可以排除物理层的问题。

我的想法是,鉴于它是间歇性的,影响多种服务,将是TCP烟囱。 看到这个知识库文章: http : //support.microsoft.com/kb/945977 ,看看是否有帮助。

之后,closures除客户端,共享和IP协议之外的networking连接面板上的所有内容。 没有QOS,没有防火墙,没有NLB,没有组合驱动程序的厂商级端口等。

再次更新

那么,所有这一切,我会说你应该通过驱动程序级高级设置下一步。 如果可以的话,在这里张贴。 如果没有,写下来,然后尝试:打开stream量控制,如果它closures – RX和TX开启/响应和生成取决于驱动程序。 然后find任何标记为卸载并closures的东西。 closures巨型帧和vlan支持。 关掉标有QOS的东西。 基本上使硬件完成所有工作,并从数据path中取出任何OS /驱动器/ CPU任务。

最后,如果您可以在“事件”期间捕获服务器,请按照本文中的步骤检查内核页面的使用情况,看看是否有助于诊断问题: http : //blogs.msdn.com/b/david.wang/存档/ 2005/09/21 / HOWTO -诊断- IIS6,未能对接受的连接,由于对连接,refused.aspx

我最后的build议

考虑closuresSynAttackProtect和其他内核级TCP保护: http ://technet.microsoft.com/en-us/library/cc781167(WS.10) .aspx或者至less碰撞可能导致它的TcpMax *设置起作用。

我可以想到两件事情:

  • 你正在用完临时端口。 如果你在linux上 – 默认设置通常是非常保守的,所以你应该经常调整它们以供生产使用。 你可以用cat /proc/sys/net/ipv4/ip_local_port_range来检查它。 请注意,这个问题可能不在服务器上,而是在你的防火墙上,尤其是在你使用NAT的情况下。

  • 您正在耗尽文件描述符。 每个TCP连接需要2个文件描述符,所以通过计算打开连接的数量,您可以估计需要的文件描述符的数量,并将其与系统限制进行比较。 ulimit -a会给你你目前的限制。 此外,默认的Linux设置是保守的(在Centos 5.x上默认的限制是1024),所以你可能需要做一些调整。

难道是你的服务通过Kerberos相互validation(通过AD),被调用的服务由于身份validation问题而停止响应? 这应该可以用NetMon或WireShark来检测。