Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

disable web proxy for a WCF client?

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 ?

like image 426
Steve B Avatar asked Jul 05 '11 08:07

Steve B


People also ask

What is WCF client proxy?

A client application uses the WCF client proxy to communicate with the service. Client applications usually import a service's metadata to generate WCF client code that can be used to invoke the service. The basic steps for creating a WCF client include the following: Compile the service code.

What is a WCF proxy class?

Actually Proxy is a class in WCF that is used to communicate with client application. We can simply get the entire configuration through the proxy class. There is no need to do extra effort to generate the configuration setting for the client. Proxy class used when you think that your service must be loosely coupled.

When using a non null proxy the WindowsProxyUsePolicy property must be set to WindowsProxyUsePolicy UseCustomProxy?

The error message 'When using a non-null Proxy, the WindowsProxyUsePolicy property must be set to WindowsProxyUsePolicy. UseCustomProxy. ' is related to a bug. Solution is to update your libs to latest version.


2 Answers

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>
like image 156
Enrico Campidoglio Avatar answered Oct 01 '22 14:10

Enrico Campidoglio


In your Binding configuration, set useDefaultWebProxy=false

like image 39
Dominik Avatar answered Oct 01 '22 14:10

Dominik