开发者

WCF: Passing Kerboros token via HTTP call instead of HTTPS

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 na开发者_如何学JAVAme: via

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

Regards, Kevin


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜