[英]How to create named pipe?
我的靜態方法中有以下代碼:
PipeSecurity ps = new PipeSecurity();
ps.AddAccessRule(new PipeAccessRule(System.Security.Principal.WindowsIdentity.GetCurrent().Name, PipeAccessRights.FullControl | PipeAccessRights.CreateNewInstance, AccessControlType.Allow));
var xserver = new NamedPipeServerStream("XSocketsPipe", PipeDirection.In);
xserver.WaitForConnection();
IFormatter f = new BinaryFormatter();
var messageReceived = (Connection)f.Deserialize(xserver);
XSocketsData.User.Add(messageReceived);
現在,當我執行我的應用程序時,我得到“拒絕訪問路徑”。 錯誤。 我究竟做錯了什么?
必須將NamedPipeServerStream實例聲明為雙向的,因此它看起來像是與構造函數有關的模糊M $錯誤消息。
請參閱以下相關問題和答案: CallNamedPipe和NamedPipeServerStream,訪問被拒絕嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.