通过Windows身份验证的单声道调用WCF服务



我有一个带有IIS的Windows服务器上托管的WCF服务,并设置为Windows身份验证(公司内部的用户必须使用域身份验证来登录其桌面(。我想用单声道从Linux(Ubuntu(调用此WCF服务。我们使用NetTCP协议,但可以更改。我将服务创建为:

var s = new WebTestService.TestServiceClient();
s.ClientCredentials.UserName.UserName = "mydomain\myuser";
s.ClientCredentials.UserName.Password = "myPassword";

,但它仍然无法实现交流。

有人知道在哪里可以解决此错误?可以解决吗?谢谢。

未经处理的例外:system.io.ioexception:无法读取来自 运输连接:连接通过对等重置。---> system.net.sockets.socketException:连接由peer重置 system.net.sockets.socket.receive(System.Byte [] Buffer,System.int32 偏移,system.int32大小,system.net.sockets.socketflags socketflags( [0x00052]在:0 at system.net.sockets.networkstream.read(system.byte [] buffer, system.int32偏移,system.int32 size([0x000b4] in :0
---内部例外的结尾 堆栈跟踪--- at(包装器托管到本地( System.Object:__ iCall_wrapper_mono_remoting_wrapper(intptr,intptr(
在(包装器远程访问( monotest.webtestservice.itestservice:gatiDentity((at at monotest.webtestservice.testserviceclient.getIdentity(([0x00007] in < 27F805F676FD42AD978EBB382E24C2D7>:0在monotest.program.main (System.String [] args([0x00050] < 27F805F676FD42AD978EBB382E24C2D7>:0 [错误]致命的 异常:system.io.ioexception:无法读取来自 运输连接:连接重置。---> system.net.sockets.socketException:连接由peer重置 system.net.sockets.socket.receive(System.Byte [] Buffer,System.int32 偏移,system.int32大小,system.net.sockets.socketflags socketflags( [0x00052]在:0 at system.net.sockets.networkstream.read(system.byte [] buffer, system.int32偏移,system.int32 size([0x000b4] in :0 ---内部异常的结尾 堆栈跟踪--- at(包装器托管到本地( System.Object:__ iCall_wrapper_mono_remoting_wrapper(intptr,intptr(
在(包装器远程访问( monotest.webtestservice.itestservice:gatiDentity((at at monotest.webtestservice.testserviceclient.getIdentity(([0x00007] in < 27F805F676FD42AD978EBB382E24C2D7>:0在monotest.program.main (System.String [] args([0x00050] < 27F805F676FD42AD978EBB382E24C2D7>:0

我在我的WCF Web服务之一中使用Windows身份验证的用户名和密码,我分配了用户名和密码:

s.ClientCredentials.Windows.ClientCredential.UserName = "mydomain\myuser";
//in my case I don't use a domain though.
s.ClientCredentials.Windows.ClientCredential.Password = "myPassword";
//I acutally use .SecurePassword and assign it SecureString

我能够在单声道上发挥作用。

即使使用"匿名"身份验证,nettcpbinding也无法(根据我的经验(。

WSHTTPBINDING无法使用(未实现方法或操作(。

basichttpbinding 工作。它可与 TransportCredentyLy 以及 Transport 安全模式,以及客户端CredentialType Windows 传输设置。在这种情况下,客户端可以在"域 username"格式和密码中设置用户名。

最新更新