WCF Client - 407 Proxy Authentication Required while running webservice
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?
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>
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>
Seems like all the traffic in your company is being redirected through a proxy. Can you browse to the web service from your IE and see its wsdl and invoke the test page to see some results. If that is the case then try adding the below section into your web.config:
<system.net> <defaultProxy> <proxy proxyaddress="<your proxy address>" bypassonlocal="true" /> </defaultProxy> </system.net>
You can find the proxy address from the settings of your IE.
NOTE: When you move to different environments then you need to make sure that its the same case else you need to remove the above configuration.
You can set the web.config of the service to allow to use the proxy settings as defined in Internet Explorer.
Sometime in the future.
WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultNetworkCredentials;