简体   繁体   English

授予IIS Web应用程序访问网络驱动器上文件的权限

[英]Give IIS web application permission to access files on network drive

I have developed an Intranet web application using C# and .NET that authenticates users using Windows Authentication 我已经使用C#和.NET开发了Intranet Web应用程序,该应用程序使用Windows身份验证对用户进行身份验证

One of the pages reads data from an excel file stored on a network drive and displays the information on screen. 页面之一从存储在网络驱动器上的excel文件中读取数据,并在屏幕上显示信息。 To access the area of the network drive where the excel file is stored you need to be a member of a certain active directory group. 要访问存储excel文件的网络驱动器区域,您需要成为某个活动目录组的成员。

When I run the application locally this works fine, as it will be running under my login ID which has permission to the network drive. 当我在本地运行该应用程序时,它可以正常运行,因为它将以我的登录ID运行,该登录ID具有对网络驱动器的许可。

However when I go to the live version of the application on our web server I get 但是,当我在Web服务器上转到应用程序的实时版本时,会得到

System.UnauthorizedAccessException: Access to the path '\\\\foo\\bar.xlsx' is denied. System.UnauthorizedAccessException:拒绝访问路径'\\\\ foo \\ bar.xlsx'。

I guess this is because the user that IIS is using doesn't have permission to the network drive. 我猜这是因为IIS使用的用户无权访问网络驱动器。

I have set up the application pool in IIS to use ApplicationPoolIdentity which i assume uses IIS_USRS but how do i give that permission to the network drive? 我已经在IIS中设置了应用程序池以使用ApplicationPoolIdentity (我假设使用IIS_USRS但是我如何向网络驱动器授予该权限?

If I change the application pool in IIS to use an account that has permissions, such as my details, instead of ApplicationPoolIdentity i get the following error instead: 如果我将IIS中的应用程序池更改为使用具有权限(例如我的详细信息)的帐户,而不是ApplicationPoolIdentity,则会收到以下错误:

Service Unavailable 暂停服务

HTTP Error 503. The service is unavailable. http错误503服务不可用。

Any help is greatly appreciated. 任何帮助是极大的赞赏。

The .xlsx files has .xlsx文件具有

application/vnd.openxmlformats-officedocument.spreadsheetml.sheet 应用/ vnd.openxmlformats-officedocument.spreadsheetml.sheet

mime type. 哑剧类型。 Go to IIS that has problem, Click on mime types button and at the table check if it has the mime type i said. 转到有问题的IIS,单击“ MIME类型”按钮,然后在表中检查它是否具有我所说的MIME类型。

我通过将服务器帐户添加到有权查看文件夹的活动目录组中来解决我的问题。

ACCESS DENIED: Same error but different scenario. 拒绝访问:相同的错误,但情况不同。 Using C# .NET to access Active Directory to change passwords via System.DirectoryServices.AccountManagement. 使用C#.NET通过System.DirectoryServices.AccountManagement访问Active Directory更改密码。 I was able to read but get the access denied trying to right back, naturally. 我能够阅读,但是自然无法获得访问权限。 This was because the application did not have rights to modify Active Directory. 这是因为该应用程序无权修改Active Directory。 To fix this, I had to add an account in web.config that had Account Operator AD rights. 要解决此问题,我必须在web.config中添加一个具有Account Operator AD权限的帐户。 Below is what I needed to add to get it to work for our situation. 以下是我需要添加的内容,以使其适合我们的情况。

<add key="adAdminUser" value="USERNAME"/>
<add key="adAdminPassword" value="PASSWORD"/>
<add key="adDomainFull" value="BLANK4US"/>

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

相关问题 从iis上托管的Web应用程序读取/写入共享驱动器中的文件 - Read/write files in shared drive from web application hosted on iis 如何授予对Godaddy服务器Web托管上的文件的访问权限? - how to give access permission to the files on godaddy server web hosting? 将文件复制到IIS中的Web应用程序文件夹会导致文件权限问题 - Copying files to web application folder in IIS causes file permission issues 从 C# Web 应用程序访问 Google Drive 文件 - Access Google Drive Files from C# Web Application 通过运行asp.net mvc Web应用程序的IIS访问映射驱动器 - Access mapped drive by IIS running asp.net mvc web application 使用托管服务帐户将文件从IIS写入网络驱动器 - Write files to network drive from IIS using Managed Service Account IIS应用程序池访问网络上的远程目录 - IIS application pool access to remote directory on network 向本地网络上的特定用户授予访问规则权限 - give access rule permission to the specific user on local network DirectoryEntry IIS访问权限 - DirectoryEntry IIS access permission 如何使用 azure 应用服务访问网络驱动器文件 - How to access Network Drive files using azure app services
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM