Calling WCF Web-Service from behind a proxy server

If you ever have any issues bypassing a proxy server in order to call a webservice (WCF or SOAP), you can modify your web-config file to show the following:

<system.net>
<defaultProxy useDefaultCredentials=”true”>
<proxy proxyaddress=”http://AAA.BBB.CCC.DDD:PORTNO&#8221; usesystemdefault=”True” />
</defaultProxy>
</system.net>

or

The proxy settings are part of the binding configuration.

<configuration>
  <system.serviceModel>

    <bindings>
      <basicHttpBinding>
        <binding name="Binding1"
                 proxyAddress = "http://myProxy">
          <security mode="None" />
        </binding>
      </basicHttpBinding>
    </bindings>

  </system.serviceModel>

</configuration>
Advertisements