1

I want to pass Kerberos token via HTTP call to a server using WCF.

I have a piece of code that successfully does this. But it only works if I make a request to HTTPS URI.

var httpBinding = new WebHttpBinding(WebHttpSecurityMode.Transport) { MaxReceivedMessageSize = Int32.MaxValue };
httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
httpBinding.Security.Transport.Realm = "MyCompany.com";

var endPoint = new EndpointAddress("https:xxxxxxxx.com/my/service);  // This works
var endPoint = new EndpointAddress("http:xxxxxxxx.com/my/service);   // This does not work

var channelFactory = new ChannelFactory<IMyServiceContract>(httpBinding, endPoint);
channelFactory.Endpoint.Behaviors.Add(new WebHttpBehavior());
_channel = channelFactory.CreateChannel();

_channel.ConsumeService();

If I make a request via the channel, and if the end point is https. It works and I can verify the Kerberos Token is in the HTTP requst.

If the service end point is HTTP, it gives error:

System.ArgumentException : The provided URI scheme 'http' is invalid; expected 'https'.
Parameter name: via

Can someone let me know how to Configure WCF so that it send Kerboros token with HTTP URI.

Regards, Kevin

Kevin
  • 5,972
  • 17
  • 63
  • 87
  • Refer this link. It will be helpful. [http://msdn.microsoft.com/en-us/library/ms730294.aspx](http://msdn.microsoft.com/en-us/library/ms730294.aspx) – Yoko Zunna Feb 23 '11 at 12:09

1 Answers1

0

When you don't want to use HTTPS you must set your security mode to WebHttpSecurityMode.TransportCredentialOnly. If you use WebHttpSecurityMode.Transport it demands HTTPS.

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670