NegotiateStream拒绝非本地管理员的客户端

时间:2021-12-25 14:02:22

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?

如何配置服务器以接受任何已登录的用户?还有其他需要看的设置吗?是否有另一种方法来验证具有域凭据的流?

1 个解决方案

#1


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"

打开文件夹 - >视图选项卡 - >选项 - >视图选项卡 - >向下滚动并取消选中“使用共享向导”

#1


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"

打开文件夹 - >视图选项卡 - >选项 - >视图选项卡 - >向下滚动并取消选中“使用共享向导”