2010-09-08 44 views
0
访问命名管道

我有一个命名管道和正常工作虽然我使用它运行在我的系统快速访问被拒绝,同时从另一个系统

客户端尝试使用下面的代码来打开文件在客户端访问:

LPTSTR lpszPipename = TEXT("\\\\smyServerName\\pipe\\iPipe01"); 

     hPipe = CreateFile( 
     lpszPipename, // pipe name 
     GENERIC_READ | // read and write access 
     GENERIC_WRITE, 
     0,    // no sharing 
     NULL,   // default security attributes 
     OPEN_EXISTING, // opens existing pipe 
     0,    // default attributes 
     NULL);  


     if (hPipe != INVALID_HANDLE_VALUE) 
     break; 

     // Exit if an error other than ERROR_PIPE_BUSY occurs. 

     if (GetLastError() != ERROR_PIPE_BUSY) 
     { 
     _tprintf(TEXT("Could not open pipe. GLE=%d\n"), GetLastError()); 
     return -1; 
     } 

在创建命名管道我用

lpszPipename = TEXT("\\\\.\\pipe\\iPipe01"); 

而不是myServerName我用.(Dot)。当我从另一个系统运行客户端时,我得到GLE 5(拒绝访问)。

+0

为用户帐户提供服务器上的所需访问权限。在serverfault.com上询问更多问题 – 2010-09-08 11:45:16

回答

1

首先要做的事 - 检查你的权限和防火墙。几乎总是,当某些东西在本地工作但不在网络上时,它就是权限。

(有这个问题,更多的时间比我可以指望!)

0

AFAIR有匿名访问命名管道在Windows Vista中的安全性的变化。
当您想要从匿名帐户中打开它(具有写权限)时,您可能必须按照here所述更改管道的安全属性。