943,985 Members | Top Members by Rank

Nov 5th, 2009
0

Windows WCF client can't authenticate with internet proxy server

Expand Post »
I have written a WCF client which consumes a 3rd party web service.

I used the Visual Studio "Add Service Reference" wizard, and have used the code that it created without a hitch. It is great.

Once I had my client tested on my own development PC and then again on another PC (where internet access is different), I started deploying my WCF client to customers. It is now installed at over 20 sites and working well.

Except: at the latest customer, it will not work because their internet connection is set up to access the internet via a proxy server, and my WCF client fails with status 407.

Now, I know what the proxy server's IP address is, and the user name and password needed to authenticate to it. What I don't know is how I provide those three things to WCF so that it will authenticate with the proxy server for me.

I have tried using
RSS, Web Services and SOAP Syntax (Toggle Plain Text)
  1. MyWcfClient.ClientCredentials.UserName.UserName = proxyUsername;
  2. MyWcfClient.ClientCredentials.UserName.Password = proxyPassword;

But that doesn't help.

I have searched around various forums for answers to this problem, and have tried some of the suggested solutions, but they seem to revolve around Windows authentication, and seem to be very, very complicated. And my application isn't really all that complicated - as I said above, it works with just the straight code as generated by the VS Service Reference wizard.

How can I specify the proxy's IP address, user name and password so that WCF will authenticate with the proxy for me?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
PeterTuffin is offline Offline
2 posts
since Jun 2008
Jan 4th, 2010
0
Re: Windows WCF client can't authenticate with internet proxy server
I am experiencing the exact same problem. Has anyone answered this yet, or have you figured out how to get around this?



I have written a WCF client which consumes a 3rd party web service.

I used the Visual Studio "Add Service Reference" wizard, and have used the code that it created without a hitch. It is great.

Once I had my client tested on my own development PC and then again on another PC (where internet access is different), I started deploying my WCF client to customers. It is now installed at over 20 sites and working well.

Except: at the latest customer, it will not work because their internet connection is set up to access the internet via a proxy server, and my WCF client fails with status 407.

Now, I know what the proxy server's IP address is, and the user name and password needed to authenticate to it. What I don't know is how I provide those three things to WCF so that it will authenticate with the proxy server for me.

I have tried using
RSS, Web Services and SOAP Syntax (Toggle Plain Text)
  1. MyWcfClient.ClientCredentials.UserName.UserName = proxyUsername;
  2. MyWcfClient.ClientCredentials.UserName.Password = proxyPassword;

But that doesn't help.

I have searched around various forums for answers to this problem, and have tried some of the suggested solutions, but they seem to revolve around Windows authentication, and seem to be very, very complicated. And my application isn't really all that complicated - as I said above, it works with just the straight code as generated by the VS Service Reference wizard.

How can I specify the proxy's IP address, user name and password so that WCF will authenticate with the proxy for me?
Reputation Points: 10
Solved Threads: 1
Newbie Poster
FRoeIDI is offline Offline
1 posts
since Jan 2010
Jan 6th, 2010
0

I actually worked it out

Click to Expand / Collapse  Quote originally posted by FRoeIDI ...
I am experiencing the exact same problem. Has anyone answered this yet, or have you figured out how to get around this?
I should have posted the solution here when I found it, forgive me.
But this is what worked in the end:
RSS, Web Services and SOAP Syntax (Toggle Plain Text)
  1. BasicHttpBinding binding = new BasicHttpBinding("APISoap"); /* APISoap is the name of the binding element in the app.config */
  2. binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
  3. binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Basic;
  4. binding.UseDefaultWebProxy = false;
  5. binding.ProxyAddress = new Uri(string.Format("http://{0}:{1}", proxyIpAddress, proxyPort));
  6. EndpointAddress endpoint = new EndpointAddress("http://www.examplewebservice/api.asmx");
  7.  
  8. WebServiceClient client = new WebServiceClient(binding, endpoint);
  9.  
  10. client.ClientCredentials.UserName.UserName = proxyUserName;
  11. client.ClientCredentials.UserName.Password = proxyPassword;
Reputation Points: 10
Solved Threads: 0
Newbie Poster
PeterTuffin is offline Offline
2 posts
since Jun 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in RSS, Web Services and SOAP Forum Timeline: storing image through the webservice into a database
Next Thread in RSS, Web Services and SOAP Forum Timeline: VS2008 Installed no wsdl.exe?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC