具有不同用户会话下的命名管道的WCF [英] WCF with named pipe under different user sessions

查看:89
本文介绍了具有不同用户会话下的命名管道的WCF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可以在同一盒子上的不同用户会话下同时激活的应用程序.它由一个客户端和一个服务器组成,它们都在交互式用户下运行,并通过WCF在命名管道上进行通信.

I have an application that can be active simultaneously under different user sessions on the same box. It consists of a client and a server, both running under the interactive user and communicating via WCF over named pipes.

如果我创建一个侦听WCF服务器的服务器,例如"net.pipe://localhost/MyService",则该服务器进程的两个实例不能在同一用户会话下存在,但是WCF允许两个服务器使用同一实例不同用户会话下的基本地址.

If I create a WCF server listening on, say, "net.pipe://localhost/MyService" ... two instances of the server process cannot exist under the same user session, but WCF allows two servers using this same base address under the different user sessions.

这是我的问题;

  • 如果WCF不使用URI作为管道名称,客户端如何找到服务器?

  • if WCF does not use the URI as the pipe name, how does the client find the server?

WCF如何防止在不同用户会话下运行的服务器的两个实例相互干扰? (例如,用户会话"A"下的客户端始终与用户会话"A"下的服务器通信,而不是服务器在用户会话"B"下运行的服务器)

how does WCF keep two instances of my server, running under different user sessions, from interfering from each other? (e.g. client under user session 'A' always communicates with server under user session 'A' and never the server running under user session 'B')

提前谢谢.

推荐答案

WCF生成一个GUID,并将其用作命名管道的名称.

WCF generates a GUID and uses that as the name for the named pipe.

URI用于导出共享内存对象的位置.服务器实际上将使用要使用的命名管道的GUID创建该共享内存对象.客户端将读取共享内存对象以获得GUID.

The URI is used to derive the location of a shared memory object. The server will actually create that shared memory object with the GUID of the named pipe to use. The client will read the shared memory object to obtain the GUID.

此共享内存对象仅限于用户会话.不同的用户会话意味着不同的命名管道.

This shared memory object is constrained to the user session. A different user session means a different named pipe.

参考文献:

https://stackoverflow.com/a/10342690/107177

这篇关于具有不同用户会话下的命名管道的WCF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆