1

我有一个使用 netTcpBinding 的自托管 WCF 服务。是否有一个类可以用来访问调用该服务的客户端的域用户名。我尝试查看OperationContext但无法弄清楚。谢谢

4

1 回答 1

1

试试这个:

ServiceSecurityContext serviceSecurityContext = ServiceSecurityContext.Current;
if (serviceSecurityContext != null)
{
  string accountText = serviceSecurityContext.WindowsIdentity.Name;
}

WindowsIdentity 属性包含大量有关用户的信息。

于 2012-09-20T15:38:46.127 回答