IIS7 访问网络共享 [英] IIS7 Accessing Network Share

查看:27
本文介绍了IIS7 访问网络共享的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 PHP 5.4 在 Windows Server 2008 R2 上运行 IIS 7.我的一个 PHP 脚本正在尝试使用 UNC 路径访问受保护网络共享上的文件.如何将 IIS 服务帐户更改为有权访问共享的帐户?这在 Apache HTTP 服务器上很容易做到(您只需更改它),但不清楚如何使用 IIS.我能做什么?

I am running IIS 7 on Windows Server 2008 R2 with PHP 5.4. One of my PHP scripts is trying to access a file on a protected network share using a UNC path. How can I change the IIS service account to an account that has permission to access the share? This is really easy to do on Apache HTTP server (you just change it), but it's not clear how to do with IIS. What can I do?

更新:

我能够使用我网站的基本设置"中的连接为"选项让事情正常进行,然后指定一个可以访问网络共享的帐户.看来我的问题与这个问题有关:

I was able to get things working using the "Connect As" option in the "Basic Settings" of my website and then specifying an account that has access to the network share. It appears that my problem is related to this question:

https://serverfault.com/questions/366234/iis-identities-application-pool-vs-connect-as-in-basic-settings

推荐答案

对于在 Windows Server 2008 R2 上运行的 IIS 7 ... 在 IIS Manager 中,选择 Application Pool 您的网站在其下运行.

For IIS 7 running on Windows Server 2008 R2 ... In the IIS Manager, select the Application Pool under which your Web Site is running.

点击高级设置".Identity 将有一个条目(它位于 Process Model 部分下).单击它,为您有权访问共享的帐户提供凭据.

Click "Advanced Settings". There will be an entry for Identity (it is under the Process Model section). Click it, provide credentials for your account that has permission to access the share.

更新

如果您使用的是 Active Directory 域帐户,则应确保在 Identity 下为正在运行的应用程序池正确提供了该帐户.例如,MYDOMAINmyAccount.

You should make sure that if you are using an Active Directory Domain Account, you provided that correctly under Identity for the running App Pool. For example, MYDOMAINmyAccount.

进行此更改后,您需要执行以下操作:

After making this change, you will need to do the following:

  1. 停止网站.
  2. 回收您的应用程序池.
  3. 启动网站.

更新 II

从对此答案的评论讨论中,@HydroPowerDeveloper 能够使用 WebSite -> Basic Settings -> "Connect As" 并在那里设置凭据,使 PHP 脚本能够通过 UNC 路径访问网络共享.

From the comment discussion on this answer, @HydroPowerDeveloper was able to get the PHP script to be able to access the network share via UNC path using WebSite -> Basic Settings -> "Connect As" and setting the credentials there.

过去,我一直使用通过 Application Pool 设置 Identity 的方法,这允许我的代码通过 UNC 路径访问网络共享.

In the past, I have always used the approach of setting Identity via Application Pool and that has allowed my code to access Network shares via UNC path.

但是,我在 IIS 上部署的所有站点/应用程序都是基于 .NET 的 WCF 或 ASPX 站点.

However, all of the sites/applications I have deployed on IIS are .NET based WCF or ASPX sites.

我推测(但不是 100% 确定这一点,需要研究/测试来确认)Application Pool 中指定的 Identity 是通过执行来使用的.NET 代码,而 PHP 脚本使用Connect As".

I would speculate (but am not 100% certain on this, would need research/testing to confirm) that the Identity specified in the Application Pool is used by executing .NET code, whereas the "Connect As" is used by the PHP script.

这篇关于IIS7 访问网络共享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆