问题
To Anyone who can help! I have been trying to have a c# application that talks named pipes work across a network between two pc's. The applications work perfectly on the same pc and on pc's within the same domain. But I have issues when one pc is in a "Workgroup" and one is on a domain. Security on the server is not an issue, I can make it as open as possible.
Background Info:
- Client - PC is in a domain, can connect to server via c$ admin share
- Server - Not in a domain, application running as a console, firewall disabled, enabled "Allow inbound file and printer sharing" Port 445.
It seems that I cannot access any named pipes on the remote server. Code:
// Client Connection
PipeStream pipe = new NamedPipeClientStream("192.168.1.102", "TEMP_PIPE", PipeDirection.InOut, PipeOptions.Asynchronous, TokenImpersonationLevel.None);
((NamedPipeClientStream)pipe).Connect();
// Server Connection
PipeSecurity pipeSecurity = new PipeSecurity();
pipeSecurity.AddAccessRule(new PipeAccessRule("Everyone", PipeAccessRights.ReadWrite | PipeAccessRights.CreateNewInstance, AccessControlType.Allow));
PipeStream pipe = new NamedPipeServerStream("TEMP_PIPE", PipeDirection.InOut, NamedPipeServerStream.MaxAllowedServerInstances, PipeTransmissionMode.Message,
PipeOptions.Asynchronous, 0, 0, pipeSecurity);
When I attempt to connect to the server from the client Connect() I receive a "The user name or password is incorrect." error.
I am stuck, not sure if this is a C# .Net named pipes issue or a Windows issue? I am inclined to believe I need to enable named pipes somehow in windows, but not sure how (because of the username/password error). Any help is greatly appreciated. Thanks in advance!
回答1:
I've recently run into this same issue where everything worked across my desktops but failed when I tried to "talk" to a tablet. I found this article:
https://www.ca.com/us/services-support/ca-support/ca-support-online/knowledge-base-articles.tec385226.html
Access to IPC$ is denied. (Not the authentication agent's pipe in particular, but the IPC resource itself.) This is expected if your client is trying to connect to a server that is not in the client's Windows domain.
I tested this by physically connecting my (previously failing tablet) directly to my network (i.e. not a wireless connection.) The application worked and the named pipes responded as intended.
A couple of notes: All my systems are on the latest Windows 10 Pro version (Creator Update w/recent patches.) All have the 4.7 framework with Named Pipes Activation enabled. Additionally, tests with a 64-bit system talking to a 32-bit tablet still fails (same error whether physically connected or not). 64-bit to 64-bit works fine.
As it turns out, once I physically connected the tablet to the network once, some setting must've been enabled. Now I can use the tablet wirelessly and the named pipes act properly.
I'm not an expert in this area so I'm not sure of next steps but thought I'd share what I found (after a LOT of testing and updating.)
Hope this helps!
来源:https://stackoverflow.com/questions/41863392/named-pipes-across-network-gives-the-user-name-or-password-is-incorrect