从特定 IP 地址发送 SOAP 请求
我有一个具有多个 IP 地址的系统。但我只能从一个 IP 地址发起 SOAP 请求。我如何在 VB.NET 中获得它。
I have a system with multiple IP address. But I'm allowed to initiate SOAP Request only from one IP address. How do I obtain that in VB.NET.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我从来没有这样做过。看起来很复杂。
首先,阅读自定义 ASMX 的方法客户端代理了解重写代理类的
GetWebRequest
对象的基本技术。您需要重写
GetWebRequest
,以便可以获取用于发出请求的ServicePoint
。您将设置BindIPEndPoint
属性指向指向您的方法的委托,该方法将返回正确的 IP 地址。I've never done this. It looks complicated.
First, read Ways to Customize your ASMX Client Proxy to learn the basic technique of overriding the
GetWebRequest
object of your proxy class.You will need to override
GetWebRequest
so that you can grab theServicePoint
being used to make the request. You will set theBindIPEndPoint
property to a delegate pointing to a method of yours which will return the correct IP Address.在 WCF 中,当您创建 ChannelFactory 时,您可以指定您的端点(或您希望连接的 IP 地址)。
您可以通过指定不同的端点来连接到任意多个不同的 IP。
In WCF when you create your ChannelFactory you can specify your endpoint (or IP address to which you wish to connect).
You can connect to as many different IPs as you want like this by specifying different endpoints.