禁用 WCF 客户端的 Web 代理? [英] disable web proxy for a WCF client?
本文介绍了禁用 WCF 客户端的 Web 代理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的电脑有一个全局定义的代理服务器(在 Internet 选项配置中).
My computer have a proxy server defined globally (in internet options configuration).
我有一个 .Net 4 应用程序,它使用 WCF 客户端连接到远程主机.客户端代码已由 VS 添加服务引用对话框生成.由于我的代理无法访问主机,因此每次调用都以通信异常结束.
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 ?
推荐答案
您可以通过设置 BasicHttpBinding.UseDefaultWebProxy 到 false
:
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>
这篇关于禁用 WCF 客户端的 Web 代理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文