I have never done that. It looks complicated.
First, read How to Configure Your ASMX Proxy Server to learn the basic techniques for overriding GetWebRequestyour proxy class object .
You need to override GetWebRequestso that you can capture ServicePointused to execute the request. You will set the property to the BindIPEndPointdelegate pointing to your method, which will return the correct IP address.
public partial class Service1
{
protected override WebRequest GetWebRequest(Uri uri)
{
HttpWebRequest request = (HttpWebRequest) base.GetWebRequest(uri);
request.ServicePoint.BindIPEndPointDelegate = ReturnSpecificIPAddress;
return request;
}
private IPEndPoint BindIPEndPoint(
ServicePoint servicePoint,
IPEndPoint remoteEndPoint,
int retryCount)
{
return new IPEndPoint(IPAddress.Parse("10.0.0.1"), 80);
}
}