disable web proxy for a WCF client?

2019-02-16 12:28发布

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 ?

2条回答
闹够了就滚
2楼-- · 2019-02-16 12:34

In your Binding configuration, set useDefaultWebProxy=false

查看更多
走好不送
3楼-- · 2019-02-16 12:43

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>
查看更多
登录 后发表回答