在与 Web 应用程序相同的场上调用 ASP.NET Web 服务
当我尝试从 ASP.NET Web 应用程序调用 ASP.NET Web 服务时,出现以下错误。 我相信这是因为 Web 服务和 Web 应用程序位于同一个场/同一个负载均衡器后面。
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 [IP Address removed]:80
当我从本地计算机上的 Web 应用程序调用服务器场上的 Web 服务时,或者当我从服务器场上的 Web 应用程序调用本地计算机上的 Web 服务时,不会发生此错误。
知道为什么会发生这个错误吗?
I am getting the following error when I try to call an ASP.NET Web Service from an ASP.NET Web Application. I believe it is because the Web Service and Web Application are on the same Farm/behind the same Load Balancer.
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 [IP Address removed]:80
This error does not occur when I call the Web Service on the Farm from the Web App on my local machine, or when I call the Web Service on my local machine from the Web App on the Farm.
Any idea why this error is occurring?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我的问题的解决方案是在负载均衡器上打开 NATing。
该请求是从场中的服务器发送到负载均衡器的,然后负载均衡器会将该请求发送到场中的一台服务器(甚至可能是请求它的同一台服务器)。 问题是,处理请求的服务器会尝试将响应直接发送回“请求客户端”,而不是返回到负载均衡器,因此发出请求的服务器只会忽略该响应,因为它没有被处理。由负载均衡器发送。 通过打开 NAT,所有响应都会发送回负载均衡器,然后负载均衡器将响应发送到原始客户端。
The solution to my problem was to turn on NATing on the load balancer.
The request was being made from a server in the farm to the Load Balancer, then the Load Balancer would send that request to one of the servers in the farm (possibly even the same server that requested it). The problem was, the server that was handling the request would try to send the response directly back to the "requesting client" instead of back to the Load Balancer, so the server that made the request would just ignore the response because it was not being sent by the Load Balancer. By turning NATing on, all responses are sent back to the Load Balancer, and then the Load Balancer sends the response on to the original client.
这只是一个猜测,但是 Web 服务器真的可以看到正在使用的 IP 地址吗? 如果它位于负载均衡器后面的场中,则该 IP 可能会被负载均衡器本身、防火墙或代理服务器阻止。
您可以通过远程桌面访问 Web 服务器并
ping
IP 地址吗?This is just a guess, but can the web server actually see the IP address being used? If it's on a farm behind a load balancer then that IP might be being blocked by the load balancer itself or a firewall or proxy server.
Can you access the web server via remote desktop and
ping
the IP address?场节点上的 TCP/IP 堆栈不会将呼叫路由到负载均衡器的 IP 地址,但会自动将其转换为进行呼叫的特定场节点上 127.0.0.1:80 上的本地呼叫。 确保您的网络服务器已设置为可以处理这种情况。
The TCP/IP stack on your farm node is not going to route the call to the IP address of the load balancer, but will automatically translate this into a local call on 127.0.0.1:80 on the specific farm node that is making the call. Make sure your web servers are set up to handle this case.