简体   繁体   中英

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. The service makes calls to an external web service, hosted by a third party.

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.

Is there a way in .NET to extract this information? Would I be better asking the same question on ServerFault for a non-programming approach?

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.

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.

In normal cases, the outbound IP of the server will be the same as the one receiving the request.

IIS does nothing more then answering the request on the same interface.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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