1
我想通过HTTP调用将Kerberos令牌传递给使用WCF的服务器。WCF:通过HTTP调用传递Kerboros令牌而不是HTTPS
我有一段代码成功地做到了这一点。但只有在向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();
如果我通过通道发出请求,并且终点是https。它工作正常,我可以验证Kerberos令牌是否在HTTP请求中。
如果服务端点是HTTP,它提供了错误:
System.ArgumentException : The provided URI scheme 'http' is invalid; expected 'https'.
Parameter name: via
有人可以让我知道如何配置WCF,使其发送Kerboros令牌HTTP URI。
问候, 凯文
请参阅此链接。这将有所帮助。 [http://msdn.microsoft.com/en-us/library/ms730294.aspx](http://msdn.microsoft.com/en-us/library/ms730294.aspx) – 2011-02-23 12:09:08