web service proxy setting

后端 未结 4 1333
悲哀的现实
悲哀的现实 2021-02-10 02:07

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

    Try adding this to app.config file.

    <system.net> 
        <defaultProxy enabled="false" useDefaultCredentials="false"> 
            <proxy/> 
        </defaultProxy> 
    </system.net> 
    

    Add proxy in the proxy tag. Use the default proxy tag in the system.net setting in the app.config.

    0 讨论(0)
  • 2021-02-10 02:34

    Create the app config file containing the following

    <system.net>
        <defaultProxy useDefaultCredentials="true">
            <proxy usesystemdefault="True" bypassonlocal="True"/>
        </defaultProxy>
    </system.net>
    

    More info here http://blogs.infosupport.com/blogs/porint/archive/2007/08/14/Configuring-a-proxy_2D00_server-for-WCF.aspx

    Bye

    0 讨论(0)
  • 2021-02-10 02:45

    Add this to your app.config or web.config:

    <system.net>
      <defaultProxy enabled="true">
        <proxy proxyaddress="http://111.222.333.444:80"/>
      </defaultProxy>
    </system.net>
    
    0 讨论(0)
  • 2021-02-10 02:46

    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");
    }
    
    0 讨论(0)
提交回复
热议问题