0

I am having a problem getting through an authenticating proxy using Basic authentication with WSHttpBinding.

Similar code for BasicHttpBinding works. I am guessing that my problem something to do with the fact that I can't set the Security mode of the WSHttpBinding to TransportCredentialOnly..

I can't use BasicHttpBinding because of a dependency on MTOM.

        binding.ProxyAddress = new Uri("http://192.168.20.231:8080");
        binding.BypassProxyOnLocal = true;
        binding.UseDefaultWebProxy = false;

        WSHttpSecurity security = binding.Security;

        //security.Mode = SecurityMode.TransportCredentialOnly; //This option only exist for BasichHttpBinding
        security.Mode = SecurityMode.Transport; // Not sure what to set here

        //security.Mode = SecurityMode.TransportWithMessageCredential;
        security.Transport.ProxyCredentialType = HttpProxyCredentialType.Basic;
        security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;


        var client = new SyncWcfMTOMServiceClient(binding, new EndpointAddress("http://server/service.svc"));

        client.ClientCredentials.UserName.UserName = "user";
        client.ClientCredentials.UserName.Password = "pass";
        bool running = client.IsServiceRunning();
Philip Fourie
  • 111,587
  • 10
  • 63
  • 83

2 Answers2

0

ist of all the one thing i would like to point out here Security.Mode =Transport is used in case if your targeted service is hosted on https (ssl) which is not the case with your specified URL

security.Mode = SecurityMode.Transport; // Not sure what to set here
Usman Masood
  • 1,937
  • 2
  • 17
  • 33
0

After some research I found an answer to this. (I am not entirely happy with the solution and hoping there is yet another way to solve this)

wsHttpBinding doesn't allow sending a username and password in clear text, not even to a local authenticating proxy! basicHttpBinding does not have this problem

After some testing I found I can get it to work by installing a server certificate on the hosting server (not to be confused with the proxy server).

By installing the SSL certificate on the server the code above works without modification. SSL on the server creates a number of problems for me.

Any other way solution for this problem?

Philip Fourie
  • 111,587
  • 10
  • 63
  • 83