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

徘徊边缘 提交于 2019-12-11 10:47:25

问题


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?


回答1:


Ok, a solution:

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

Pileggi



来源:https://stackoverflow.com/questions/12247129/set-usedefaultwebproxy-false-on-wcf-client-with-the-web-references

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!