View current opened netNamedPipe channels?

2019-07-08 08:08发布

问题:

Is there any way I can determine which netNamedpipe channels are currently open? This will help me debug my WCF Client/Server and make sure I am closing my channels properly.

This is similar to the netstat tool for network connections, but for netNamedPipes instead.

回答1:

There is no tool to do this, as far as I am aware.

You can use Process Explorer to find what handles to named pipe objects a process is holding, but this will not really answer your question. To recognise pipes which are created for WCF NetNamedPipeBinding channels you need to know what you are looking for. WCF pipes will incorporate a GUID in their name, looking something like this:

\\.\pipe\197ad019-6e5f-48cb-8f88-02ae11dfd8c0

See here for more on this.

However, the fact that a handle exists doesn't per se tell you anything about the state of the channel. There is a WCF pooling mechanism for pipe connections, so even if the channel is properly closed this does not guarantee that the pipe connection itself has been dropped and the handle released (though if you were to see a process gradually acquiring more and more handles that would suggest there might be a problem with channel cleanup).

If you want to confirm that channels are being cleaned-up promptly I would suggest you enable WCF Tracing in verbose mode: this will tell you exactly what is going on.



回答2:

You can use Process Explorer to see what pipes a process has open:

http://technet.microsoft.com/en-us/sysinternals/bb896653



回答3:

SysInternals has a command called PipeList. I believe you can download the command separately here:

http://technet.microsoft.com/en-us/sysinternals/dd581625