1
votes

I have a WCF service hosted on a Windows Server with IIS, and is set to Windows Authentication (the users inside the company must use domain authentication to login their desktop). I want to call this WCF service from a linux (ubuntu) with Mono. We uses netTcp protocol, but it can be change. I create the service as:

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

But it still does not enable the communication.

Does anyone have an idea where to fix this error? Does it possible to resolve?Thanks in advance.

Unhandled Exception: System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer. ---> System.Net.Sockets.SocketException: Connection reset by peer at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.Net.Sockets.SocketFlags socketFlags) [0x00052] in :0 at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, System.Int32 offset, System.Int32 size) [0x000b4] in :0
--- End of inner exception stack trace --- at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_remoting_wrapper (intptr,intptr)
at (wrapper remoting-invoke) MonoTest.WebTestService.ITestService:GetIdentity () at MonoTest.WebTestService.TestServiceClient.GetIdentity () [0x00007] in <27f805f676fd42ad978ebb382e24c2d7>:0 at MonoTest.Program.Main (System.String[] args) [0x00050] in <27f805f676fd42ad978ebb382e24c2d7>:0 [ERROR] FATAL UNHANDLED EXCEPTION: System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer. ---> System.Net.Sockets.SocketException: Connection reset by peer at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.Net.Sockets.SocketFlags socketFlags) [0x00052] in :0 at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, System.Int32 offset, System.Int32 size) [0x000b4] in :0 --- End of inner exception stack trace --- at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_remoting_wrapper (intptr,intptr)
at (wrapper remoting-invoke) MonoTest.WebTestService.ITestService:GetIdentity () at MonoTest.WebTestService.TestServiceClient.GetIdentity () [0x00007] in <27f805f676fd42ad978ebb382e24c2d7>:0 at MonoTest.Program.Main (System.String[] args) [0x00050] in <27f805f676fd42ad978ebb382e24c2d7>:0

2
I think there are other issues at play here. Can you get it working without authentication first, then add the authentication once it works?Popo
Using anonymous auth it works like a charm.Zoltan Hernyak

2 Answers

1
votes

I use a username and password for windows authentication in one of my wcf web services, I assign the username and password like so:

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
0
votes

I was able to make it work on Mono.

The netTcpBinding won't work (according to my experience) even with the "anonymous" authentication.

The wsHttpBinding won't work (method or operation is not implemented).

Only the basicHttpBinding works. It works with TransportCredentialOnly and also Transport security modes, with clientCredentialType Windows transport setting. In this case the client can set the username in "domain\username" format, and the password.