创建命名管道 (WCF) 所需的最低操作系统权限

发布于 2024-09-30 07:49:24 字数 182 浏览 0 评论 0原文

我有一个在登录用户的上下文中运行的 exe。该exe使用WCF使自己成为一个命名管道服务器(它将被多个客户端调用)。

用户是否需要特定权限才能使 exe 创建命名管道?我尝试以具有相当小的权限的用户身份运行(即仅在本地用户组中),这工作正常 - 但我担心当我部署到客户端站点时,用户可能会受到某种方式的限制意味着命名管道创建不起作用。

I have an exe that runs under the context of the logged-in user. The exe uses WCF to make itself a named pipe server (it will be called by multiple clients).

Does the user need a specific permission for the exe to be able to create the named pipe? I've tried running as a user with fairly minimal permissions (i.e. just in the local Users group), and this works fine - but I'm concerned that when I deploy to the clients site, the users may be limited in some way that means the named pipe creation doesn't work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乜一 2024-10-07 07:49:24

本地登录用户无需特殊权限即可使用 netNamedPipe 绑定设置 WCF 服务的服务端。

但是,您确实需要担心客户端是否可以找到并连接到该服务。这有两个方面:

  1. 客户端必须在不是通过网络登录建立的安全上下文中运行(例如在 Web 应用程序中模拟远程用户)。这是因为 WCF 拒绝对 NETWORK USERS 组成员的任何登录进行访问。
  2. 如果您在 Vista 或 Windows7 上运行,并且您希望在登录用户会话之外运行的客户端可以访问服务 exe,则需要使用 SeCreateGlobalPrivilege 权限运行服务 exe。这是因为 WCF 服务需要将管道名称发布到共享内存对象,以便客户端能够找到它:如果 WCF 服务堆栈可以在全局命名空间中创建此共享内存对象(对所有登录会话可见),那么它就会这样做。但如果它没有必要的权限,它会在本地命名空间中创建共享内存对象(仅在同一登录会话中可见)。将 WCF 服务部署为 Windows 服务是让它以此权限运行并因此对其会话之外的客户端可见的唯一简单方法。

更多详细信息此处如果你有兴趣的话。

No special permissions are required for a locally logged on user to set up the service end of a WCF service using the netNamedPipe binding.

However, you do need to worry about whether the clients can find and connect to the service. There are two aspects to this:

  1. The clients must be running in a security context which is not established by a network logon (such as impersonation of a remote user in a web application). This is because WCF denies access to any logon which is a member of the NETWORK USERS group.
  2. If you are running on Vista or Windows7, the service exe will need to be running with the privilege SeCreateGlobalPrivilege if you want the service to be accessible to clients running outside the logged on user's session. This is because the WCF service needs to publish the pipe name to a shared memory object to enable clients to find it: if the WCF service stack can create this shared memory object in the Global namespace (visible to all logon sessions), it will. But if it does not have the necessary privileges, it creates the shared memory object in the Local namespace (visible only within the same logon session). Deploying the WCF service as a Windows service is the only easy way to get it running with this privilege and thus visible to clients outside its session.

More details here if you are interested.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文