简体   繁体   English

确定Web服务出站IP地址

[英]Determining webservice outbound IP Address

My business has a .NET web service (not WCF) hosted in IIS on a server which has four network interfaces. 我的公司在具有四个网络接口的服务器上的IIS中托管着.NET Web服务(不是WCF)。 The service makes calls to an external web service, hosted by a third party. 该服务调用由第三方托管的外部Web服务。

In order to configure firewalls correctly internally and at the third party, we need to know which of the available IP addresses on the server the web service is making requests on. 为了在内部和第三方正确配置防火墙,我们需要知道Web服务在服务器上请求哪个可用IP地址。

Is there a way in .NET to extract this information? .NET中是否有一种方法可以提取此信息? Would I be better asking the same question on ServerFault for a non-programming approach? 对于非编程方法,我是否会在ServerFault上问相同的问题更好?

It might be possible to get the information from the router programmatically, but that would not be trivial... Just send a request to a site like whatismyip.com, and see what IP address it is telling you that it gets the request from. 可能有可能通过编程方式从路由器获取信息,但这并不是一件容易的事……只需将请求发送到类似whatismyip.com的站点,然后查看它告诉您的IP地址就是从中获取请求的。

I don't know how the multiple network insterfaces affect the traffic. 我不知道多个网络界面如何影响流量。 The safest would of course be if the third party could just put up a page that returns the IP adress that the request comes from, so that you know that you are sending the request in the exact same way as the web service request. 最安全的当然是第三方是否可以建立一个返回请求源IP地址的页面,从而使您知道您正在以与Web服务请求完全相同的方式发送请求。

In normal cases, the outbound IP of the server will be the same as the one receiving the request. 在正常情况下,服务器的出站IP将与接收请求的IP相同。

IIS does nothing more then answering the request on the same interface. IIS只会在相同的界面上回答请求,然后再执行其他操作。

If you want to be sure, i think it might be easier indeed to simple check your firewall logs then to start coding stuff around it to find out. 如果您想确定的话,我认为简单检查防火墙日志然后开始对其周围的代码进行查找可能确实更容易。

Every firewall that is half worth it's money has logging which can easily tell you what traffic is going from where to where. 每个价值不菲的防火墙都具有日志记录功能,可以轻松告诉您从何处流向何处的流量。

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

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