.NET 3.5(C#)通过网络命名管道管道、网络、NET

2023-09-03 06:40:42 作者:肉体自杀

我努力让一个.NET(不会一个WCF)命名管道在网络上进行通信。该 MSDN文档意味着这是可能的,不仅如此微不足道。但我的code:

I'm struggling to get a .NET (NOT a WCF) named pipe to communicate across the network. The MSDN documentation implies this is possible, nay trivial. But my code:

 using (NamedPipeClientStream pipeClient = new NamedPipeClientStream(servername, "myPipe", PipeDirection.InOut, PipeOptions.None, TokenImpersonationLevel.Impersonation))

...伟大工程时,服务器名称=本地主机和管服务器在同一个盒子。但如果它是另一台机器 - 我不管做服务器名的IP地址,DNS名称,NetBIOS名称,UNC路径等 - 意味着永远连接管。它实际上并没有失败,pipeClient.Connect()只是坐在那里。

... works great when servername="localhost" and the pipe server is on the same box. But if it's another machine - regardless whether I make servername an IP address, DNS name, NetBIOS name, UNC path etc - means the pipe never connects. It doesn't actually fail, pipeClient.Connect() just sits there.

还有各种论坛,博客以及有关这个网站这么多不同的和相互冲突的职务。任何人都可以打抱不平,告诉我:我怎么命名管道客户端从一个C#应用程序在一台计算机连接到上另一台机器上运行的命名管道服务器

There's so many different and conflicting posts on various forums, blogs and sites about this. Can anyone set the record straight and tell me: how do I get a Named Pipe Client to connect from one C# application on one machine to a Named Pipe Server running on an another machine?

推荐答案

您在工作中做这个?是企业防火墙或防病毒程序运行?检查你的任务通知图标区域中的Windows事件日志和任何应用程序在你的启动栏的提示是谁阻止这一点。

Are you doing this at work? Is a corporate firewall or anti-virus program running? Check the windows event logs and any applications in your task notification icons area on your start bar for hints as to who is blocking this.

 
精彩推荐
图片推荐