I have a very basic client/server test set up that fails with the message:
The server has rejected the client credentials.
Unless the client is logged on as an account that has admin rights on the server. This is something I do not want.
Here is my client code:
var formatter = new BinaryFormatter();
...
using (var client = new TcpClient(ip, 1248))
using (var stream = client.GetStream())
using (var negStream = new NegotiateStream(stream, false))
{
await negStream.AuthenticateAsClientAsync(CredentialCache.DefaultNetworkCredentials, string.Empty, ProtectionLevel.EncryptAndSign, TokenImpersonationLevel.Identification));
formatter.Serialize(negStream, "This is a test!");
}
And here is my server code:
var listener = new TcpListener.Create(1248);
listener.Start();
var tcpClient = listener.AcceptTcpClient();
using (var stream = tcpClient.GetStream())
using (var negStream = new NegotiateStream(stream, false))
{
await negStream.AuthenticateAsServerAsync(CredentialCache.DefaultNetworkCredentials, ProtectionLevel.EncryptAndSign, TokenImpersonationLevel.Identification));
Console.WriteLine(formatter.Deserialize(negStream));
}
How do I configure the server to accept any logged on user? Is there another setting I need to look at? Is there another way to authenticate a stream with domain credentials?
This May sound crazy, but you can give it a try, ,it worked for me anyway
open folder-> view tab -> options -> view tab -> scroll down and uncheck "use sharing wizard"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With