简体   繁体   English

您如何允许 IIS 访问符号链接文件夹?

[英]How do you allow IIS to access a symlink folder?

I have a two webservers, on each webserver in the C:\inetpub\logs\LogFiles I have created a symbolic link to the other servers log file folders, so essentially I can be logged in to one of the webservers and see the logs on both servers in one place.我有两个网络服务器,在 C:\inetpub\logs\LogFiles 中的每个网络服务器上我创建了指向其他服务器日志文件文件夹的符号链接,所以基本上我可以登录到其中一个网络服务器并查看日志两台服务器都在一个地方。 This works perfectly.这完美地工作。

I am building a webpage to make the log files available via a webpage, the code simply goes to the C:\inetpub\logs\LogFiles directory and lists the files in each sub folder, ie W3SVC1 (the local folder) and webserver2-w3svc1 (the remote log folder).我正在构建一个网页以通过网页提供日志文件,代码只需转到 C:\inetpub\logs\LogFiles 目录并列出每个子文件夹中的文件,即 W3SVC1(本地文件夹)和 webserver2-w3svc1 (远程日志文件夹)。

For the local folders it works fine, but I am getting the "access denied" error when trying to call Directory.GetFiles on the symlinkd folder.对于本地文件夹,它可以正常工作,但是在尝试在符号链接文件夹上调用 Directory.GetFiles 时出现“访问被拒绝”错误。 I suspect this is some sort of permissions error, but I tried giving the symlinkd folder full permissions to "everyone" but I still get the same error.我怀疑这是某种权限错误,但我尝试将符号链接文件夹完全权限授予“每个人”,但我仍然遇到同样的错误。

Is this something to do with the fact that when I created the symlinkd I had to enter the username and password of the webserver2, and these credentials cannot be accessed/used by IIS when trying to get access to the folder?这是否与以下事实有关:当我创建符号链接时,我必须输入 webserver2 的用户名和密码,而 IIS 在尝试访问该文件夹时无法访问/使用这些凭据?

Is there anything I can do allow IIS to access the contents of this symlinkd folder?我能做些什么让 IIS 访问这个符号链接文件夹的内容吗?

I don't think you need to use a symlink, you can create a virtual directory mapping to that directory in IIS, just map it to the target path.我认为您不需要使用符号链接,您可以在 IIS 中创建一个虚拟目录映射到该目录,只需将 map 映射到目标路径即可。 In IIS, right click on the website and select Add Virtual Directory.在IIS中,右键点击网站select添加虚拟目录。

For more information, please refer to this official document .更多信息请参考本官方文档

After much experimentation, the only way to do this is as follows:经过大量实验,唯一的方法如下:

  1. Create a new user on the computer.在计算机上创建一个新用户。
  2. Run the AppPool in IIS under this new users' identity as opposed to the default IUSR account.在这个新用户的身份下运行 IIS 中的 AppPool,而不是默认的 IUSR 帐户。
  3. Give the folder you are sharing permissions to this user AND 'share' this folder with the new user.将您要共享的文件夹授予此用户并与新用户“共享”此文件夹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM