web service proxy setting

后端 未结 4 995
小蘑菇
小蘑菇 2021-02-10 02:08

In c# 4.0, I have a web service called ManufacturerContactDetails. I am calling that web service from a windows app using the following:

var ws = new Manufacture         


        
4条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-10 02:27

    If this is a WCF client there is no Proxy property. You could try this instead:

    var proxy = new WebProxy("proxy.foo.com", true);
    proxy.Credentials = new NetworkCredential("user", "pass");
    WebRequest.DefaultWebProxy = proxy;
    

    and then do the call:

    using (var ws = new ManufacturerContactDetailsWebServiceSoapClient())
    {
        var cd = ws.GetContactDetails("Google");
    }
    

提交回复
热议问题