Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF Client - 407 Proxy Authentication Required while running webservice

I've created simple WinForms app that uses free webservice http://www.webservicemart.com/uszip.asmx. But this app fails to use service operation with error:

The remote server returned an unexpected response: (407) Proxy Authentication Required (The ISA Server requires authorization to fulfill the request. Access to the Web Proxy service is denied)

Code that creates proxy and triggers service operation:

ChannelFactory<ServiceReference1.USZipSoap> proxy = new ChannelFactory<ServiceReference1.USZipSoap>("USZipSoap");
ServiceReference1.USZipSoap client = proxy.CreateChannel();
string str = client.ValidateZip("12345");
MessageBox.Show(str);

Is this problem with a network of my company or this is a proxy on the side of webservicemart.com?

I've googled a lot of information on changing configuration files, creating a custom binding, etc. But I feel the lack of more basic understanding...
If this error is about ISA server of our corporate network then what configuration should I make to ISA Server to not restrict me from using external webservices?

like image 919
Alexander Serdyuk Avatar asked Jan 04 '12 07:01

Alexander Serdyuk


2 Answers

In your binding configuration make sure that useDefaultWebProxy is set to true - it will use configuration you have found in IE. In your configuration file add following snippet to ensure default your credentials are used for authentication on the proxy server:

<system.net>
  <defaultProxy useDefaultCredentials="true" />
</system.net>
like image 84
Ladislav Mrnka Avatar answered Sep 30 '22 01:09

Ladislav Mrnka


This worked for me... replacing 10.1.0.50 and the port number with your proxy server's IP

  <system.net>
    <defaultProxy useDefaultCredentials="true">
      <proxy usesystemdefault="False" proxyaddress="http://10.1.0.50:8080" bypassonlocal="True" />
    </defaultProxy>
  </system.net>
like image 33
JGilmartin Avatar answered Sep 30 '22 00:09

JGilmartin