Search code examples
wcfbindingreferenceweb-configwcf-binding

Set useDefaultWebProxy=false on WCF Client with the Web-References


I have a Windows-Forms application with added Web-References to a WCF Service. I need to set on the wcf client the property "useDefaultWebProxy" to "false".

If I had added the "Service-References", instead of the "Web-References", I could easily modify the app.config file:

<basicHttpBinding> 
  <binding name="pluto" ... useDefaultWebProxy="false"> 
   <readerQuotas ... /> 
   <security ...> 
    <transport ... /> 
    <message ... /> 
   </security> 
  </binding> 
 </basicHttpBinding> 

But I have the Web-References, how can I do?


Solution

  • Ok, a solution:

    System.Net.WebRequest.DefaultWebProxy = MyWebClient.Proxy;
    MyWebClient.MyFirstCall(username, password);
    

    Pileggi