IIS 服务器:与目录连接相比,目录无法通过符号链接写入(仅适用于第一个用户)

IIS 服务器:与目录连接相比,目录无法通过符号链接写入(仅适用于第一个用户)

我们的网络服务器设置如下:Windows Server 2008 R2 Standard、IIS 7.5.7600.16385、PHP 5.3.28,我们使用的 HMVC 框架是小花

Kohana 需要一个可写入的缓存目录D:\inetpub\www\application\cacheD:\inetpub\www\即我们的 webroot)。我们删除了此位置的缓存目录,并创建了一个符号链接到 webroot 之外的目录:D:\cache,该目录是可写的。

看起来第一个访问该网站的用户会收到错误“缓存目录不可写”,令人惊讶的是,这是 Kohana 在无权写入目录时触发的错误。第二个、第三个等等用户不会收到此错误。奇怪的是,只有第一个用户不断收到此错误,而其他用户从未看到过它。

我们的解决方案是使用目录连接点

我读A 很多 文档关于符号链接和目录连接之间的区别,但我无法将其与我们遇到的错误联系起来。我唯一能想到的是,符号链接是在客户端处理的,而连接是在服务器端处理的。

Harry Johnston 的评论帖子指向两个新链接,但我们在那里找不到问题的良好解释。

@Daan 事实上,符号链接跨越中小企业记录在 SMB 中的新增功能?中。我不知道有任何文档明确指出连接点没有,但它是它们实现方式所固有的,我确实发现创建 SYSVOL 根目录和暂存区域连接点否则就行不通了。(不过,这主要只是经验。)

更新:

我监视了进程监视器中的目录并得到以下结果:

用户:Test2,第一个用户(这里我得到了错误)

10:21:52.7311891 AM php-cgi.exe QueryOpen           D:\inetpub\www\application\cache    SUCCESS             CreationTime: 8/28/2015 5:12:56 PM, LastAccessTime: 8/28/2015 5:12:56 PM, LastWriteTime: 8/28/2015 5:12:56 PM, ChangeTime: 8/28/2015 5:12:56 PM, AllocationSize: 0, EndOfFile: 0, FileAttributes: DRP
10:21:52.7313164 AM php-cgi.exe CreateFile          D:\inetpub\www\application\cache    SUCCESS             Desired Access: Read Control, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, Impersonating: NL-COMPUTER1\Test2, OpenResult: Opened
10:21:52.7313552 AM php-cgi.exe QuerySecurityFile   D:\inetpub\www\application\cache    BUFFER OVERFLOW     Information: Owner, Group, DACL
10:21:52.7313725 AM php-cgi.exe CloseFile           D:\inetpub\www\application\cache    SUCCESS 
10:21:52.7314490 AM php-cgi.exe CreateFile          D:\inetpub\www\application\cache    SUCCESS             Desired Access: Read Control, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, Impersonating: NL-COMPUTER1\Test2, OpenResult: Opened
10:21:52.7314729 AM php-cgi.exe QuerySecurityFile   D:\inetpub\www\application\cache    SUCCESS             Information: Owner, Group, DACL
10:21:52.7314867 AM php-cgi.exe CloseFile           D:\inetpub\www\application\cache    SUCCESS 

用户:Test3,第二个用户(这里我没有收到错误)

10:28:01.7973266 AM php-cgi.exe 5220    QueryOpen           D:\inetpub\www\application\cache    SUCCESS CreationTime: 8/28/2015 5:12:56 PM, LastAccessTime: 8/28/2015 5:12:56 PM, LastWriteTime: 8/28/2015 5:12:56 PM, ChangeTime: 8/28/2015 5:12:56 PM, AllocationSize: 0, EndOfFile: 0, FileAttributes: DRP
10:28:01.7974467 AM php-cgi.exe 5220    CreateFile          D:\inetpub\www\application          SUCCESS Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, Impersonating: NL-COMPUTER1\Test3, OpenResult: Opened
10:28:01.7974702 AM php-cgi.exe 5220    QueryDirectory      D:\inetpub\www\application\cache    SUCCESS Filter: cache, 1: cache
10:28:01.7974943 AM php-cgi.exe 5220    CloseFile           D:\inetpub\www\application          SUCCESS 
10:28:01.7975657 AM php-cgi.exe 5220    CreateFile          D:\inetpub\www\application\cache    SUCCESS Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Open Reparse Point, Attributes: n/a, ShareMode: None, AllocationSize: n/a, Impersonating: NL-COMPUTER1\Test3, OpenResult: Opened
10:28:01.7976098 AM php-cgi.exe 5220    FileSystemControl   D:\inetpub\www\application\cache    SUCCESS Control: FSCTL_GET_REPARSE_POINT
10:28:01.7976285 AM php-cgi.exe 5220    CloseFile           D:\inetpub\www\application\cache    SUCCESS 
10:28:01.7977090 AM php-cgi.exe 5220    CreateFile          D:\cache                SUCCESS Desired Access: Read Control, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, Impersonating: NL-COMPUTER1\Test3, OpenResult: Opened
10:28:01.7977524 AM php-cgi.exe 5220    QuerySecurityFile   D:\cache                BUFFER OVERFLOW Information: Owner, Group, DACL
10:28:01.7977657 AM php-cgi.exe 5220    CloseFile           D:\cache                SUCCESS 
10:28:01.7978337 AM php-cgi.exe 5220    CreateFile          D:\cache                SUCCESS Desired Access: Read Control, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, Impersonating: NL-COMPUTER1\Test3, OpenResult: Opened
10:28:01.7978573 AM php-cgi.exe 5220    QuerySecurityFile   D:\cache                SUCCESS Information: Owner, Group, DACL
10:28:01.7978703 AM php-cgi.exe 5220    CloseFile           D:\cache                SUCCESS 

有谁知道为什么当我们使用符号链接而不是目录连接时第一个用户无法在目录中写入?

相关内容