如何使WCF命名管道地址等于WinApi? [英] How to make a WCF named pipe address equal to a WinApi one?

查看:113
本文介绍了如何使WCF命名管道地址等于WinApi?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到WCF的命名管道地址

I noticed that WCF's named pipe address

net.pipe://localhost/mynamedpipe

和Windows API的

and Windows API's

\\.\pipe\mynamedpipe

不要碰撞.这是为什么?如何使它们指向同一管道?

don't collide. Why is that? How can I make them point to the same pipe?

推荐答案

没有记录的方法.经过几次测试,我得出以下结论:

There is no documented way of doing that. After a few tests I came to the following conclusions:

如果您有WCF服务器和Win32 C ++客户端,则最后一个将以以下格式将第一个地址显示为UUID:

If you have a WCF server and a Win32 C++ client, the last one will see the first one address as a UUID in the following format:

12345678-1234-1234-1234-123456789abc

12345678-1234-1234-1234-123456789abc

这个UUID似乎是随机的,因为每次启动服务器时它都会更改相同的WCF地址.

And this UUID seems random, since it changes for the same WCF address every time the server is started.

我不知道从WCF客户端是否可以看到具有GUID格式地址的Win32 C ++命名管道服务器,但是我敢肯定,如果这样做,则该服务器将必须实现由以下人员使用的文献记载不充分的协议WCF.

I don't know if a Win32 C++ named pipe server with a GUID format address will be visible from a WCF client, but I'm sure that if it does, the server will have to implement the poorly documented protocol used by WCF.

此类协议的文档是对 编辑进一步的研究表明,管道地址存储在FileMapping中.该条目地址依次是NetNamedPipe地址的规范化版本的base64编码的哈希.

EDIT Further research revealed that the pipe address is stored in the FileMapping. This entry address in its turn is a base64 encoded hash of a normalized version of the NetNamedPipe address.

这篇关于如何使WCF命名管道地址等于WinApi?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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