简体   繁体   English

在与 Web 应用程序相同的场上调用 ASP.NET Web 服务

[英]Call ASP.NET Web Service on the Same Farm as Web Application

I am getting the following error when I try to call an ASP.NET Web Service from an ASP.NET Web Application.当我尝试从 ASP.NET Web 应用程序调用 ASP.NET Web 服务时出现以下错误。 I believe it is because the Web Service and Web Application are on the same Farm/behind the same Load Balancer.我相信这是因为 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

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.当我从本地计算机上的 Web 应用程序调用场上的 Web 服务时,或者当我从场上的 Web 应用程序调用本地计算机上的 Web 服务时,不会发生此错误。

Any idea why this error is occurring?知道为什么会发生此错误吗?

The solution to my problem was to turn on NATing on the load balancer.我的问题的解决方案是在负载均衡器上打开 NATing。

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.通过打开 NATing,所有响应都被发送回负载均衡器,然后负载均衡器将响应发送到原始客户端。

This is just a guess, but can the web server actually see the IP address being used?这只是一个猜测,但 Web 服务器真的可以看到正在使用的 IP 地址吗? 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.如果它位于负载平衡器后面的场中,那么该 IP 可能被负载平衡器本身或防火墙或代理服务器阻止。

Can you access the web server via remote desktop and ping the IP address?您可以通过远程桌面访问 Web 服务器并ping IP 地址吗?

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.您场节点上的 TCP/IP 堆栈不会将调用路由到负载均衡器的 IP 地址,但会自动将其转换为发出呼叫的特定场节点上 127.0.0.1:80 上的本地调用. Make sure your web servers are set up to handle this case.确保您的网络服务器设置为处理这种情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM