开发者

disable web proxy for a WCF client?

开发者 https://www.devze.com 2023-03-17 13:41 出处:网络
My computer have a proxy server defined globally (in internet options configuration). I have a .Net 4 application that开发者_运维百科 use a WCF client to a remote host. The client code has been gener

My computer have a proxy server defined globally (in internet options configuration).

I have a .Net 4 application that开发者_运维百科 use a WCF client to a remote host. The client code has been generated by VS add service reference dialog. As my proxy can't reach the host, each call ends with a communication exception.

How can I set up my client configuration to not use the default proxy ?


You can tell WCF not to use the default proxy by setting the BasicHttpBinding.UseDefaultWebProxy to false:

<client>
    <endpoint address="http://server/myservice"
              binding="basicHttpBinding"
              contract="IMyService" />
</client>
<bindings>
    <basicHttpBinding>
        <binding useDefaultWebProxy="false" />
    </basicHttpBinding>
</bindings>


In your Binding configuration, set useDefaultWebProxy=false

0

精彩评论

暂无评论...
验证码 换一张
取 消