Message Code 【27796】 Failed to connect to server 'hostname';port_ld': 'reason'.

Message Code 【27796】 Failed to connect to server 'hostname';port_ld': 'reason'.
Unable to connect to the specified server and port. 

-------- Troubleshooting-----------------------------------
o      Try to address the reason provided for the connection failure.
o      Try to access the application with a browser from the injector machine and from another machine (such as the recording machine).
o      Check that you accurately specified the correct host name and port.
o      Ping the host/port.
o      Check if the server application you are trying to access is running.
o      If you used a hostname, check if it was resolved to the correct address.
o      Check if the server application is listening to the right port.

 
--------- 经验-----------------------------------------------------------------------------------------------------------------
    如果负载生成器的性能好,发数据包特别快,服务器也响应特别快,可能导致负载生成器的机器的端口在没有timeout 之前就全部占满了。在全部占满后,就会出现上面的错误。执行netstat –na命令,可以看到打开了很多端口。所以调整TCP的time out。即在最后一个端口还没有用到时,前面已经有端口在释放了。
    解决:负载生成器的注册表HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters,修改如下两个键值:
   1.TcpTimedWaitDelay :默认值30s,把这个值调小为5s(按需调整)。
   2.MaxUserPort :如果这个值不是最大值的话,调大

TcpTimedWaitDelay 
确定 TCP/IP 可释放已关闭连接并重用其资源前,必须经过的时间。关闭和释放之间的此时间间隔通称 TIME_WAIT 状态或两倍最大段生命周期(2MSL)状态。此时间期间,重新打开到客户机和服务器的连接的成本少于建立新连接。减少此条目的值允许 TCP/IP 更快地释放已关闭的连接,为新连接提供更多资源。如果运行的应用程序需要快速释放和创建新连接,而且由于 TIME_WAIT 中存在很多连接,导致低吞吐量,则调整此参数。
设置:
使用 regedit 命令访问 HKEY_LOCAL_MACHINESYSTEMCurrentControlSet ServicesTCPIPParameters 注册表子键

创建名为 TcpTimedWaitDelay 的新 REG_DWORD 值。 
缺省值:0xF0,它将等待时间设置为 240 秒(4 分钟)。建议值:最小值为 0x1E(十六进制 0x0000001e),它将等待时间设置为 30 秒。 
停止并重新启动系统。
MaxUserPort
确定在应用程序从系统请求可用用户端口时,TCP/IP 可指定的最高端口号。如发生错误异常,可能是匿名(短期)端口的数量不当造成,当系统开启大量端口来建立web 服务、资料库或其它远程资源连接时,尤其如此。
设置:
使用 regedit 命令访问 HKEY_LOCAL_MACHINESYSTEMCurrentControlSet ServicesTCPIPParameters 注册表子键

创建名为 MaxUserPort 的新 REG_DWORD 值。
缺省值:无
建议值:至少十进制 32768。

停止并重新启动系统。
注:当在 Windows NT 或 Windows 2000 操作系统上调整 WebSphere Application Server 时,同时使用这两个参数。

 

原文地址:https://www.cnblogs.com/yanghj010/p/3624224.html