我有一些代码尝试模拟调用者的Windows安全设置,然后连接到另一台机器上的另一个WCF服务
WindowsIdentity callerWindowsIdentity = ServiceSecurityContext.Current.WindowsIdentity;
using (callerWindowsIdentity.Impersonate())
{
NetTcpBinding binding = new NetTcpBinding();
binding.Security.Mode = SecurityMode.Message;
binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
EndpointAddress endpoint = new EndpointAddress(new Uri("net.tcp://serverName:9990/TestService1"));
ChannelFactory<WCFTest.ConsoleHost.IService1> channel = new ChannelFactory<WCFTest.ConsoleHost.IService1>(binding, endpoint);
WCFTest.ConsoleHost.IService1 service = channel.CreateChannel();
return service.PrintMessage(msg);
}
Run Code Online (Sandbox Code Playgroud)
但是我收到错误:"调用者没有通过服务验证"System.ServiceModel ....由于身份验证失败,无法满足安全令牌的请求...
我试图模仿的凭据是服务所在框的valide windows凭证.
有什么想法吗?
归档时间: |
|
查看次数: |
2719 次 |
最近记录: |