Web服务器上的ASP.NET应用程序访问另一台服务器上的共享文件夹的权限 [英] Permission for ASP.NET application on web server to access shared folder on another server

查看:173
本文介绍了Web服务器上的ASP.NET应用程序访问另一台服务器上的共享文件夹的权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Web服务器上的ASP.NET应用程序访问其他服务器上的共享文件夹所需的全部权限是什么

推荐答案

默认情况下,Asp.net辅助进程在内置的"ASPNET"或网络服务"用户帐户下运行,该用户帐户没有足够的权限来访问另一台服务器上的共享文件夹.

因此,您需要覆盖应用程序设置,以便您的应用程序在其他用户帐户下运行.这就是模拟.

您要做的只是以下操作:

1.在服务器上创建一个用户帐户,并确保该用户帐户具有足够的权限以从Web服务器内部访问共享文件夹.

2.通过在应用程序的web.config中添加以下配置元素来模拟您的应用程序:

< identity impersonate ="true" username ="theNewlyCreatedUserAccount" password =用户帐户的密码"/>
By default, the Asp.net worker process runs under the built in "ASPNET" or "Network Service" user account which does not have enough permission to access shared folder on another server.

So, you need to override your application setting so that, your application runs under a different user account. That is called Impersonation.

All you have to do is the followings:

1. Create a user account on your server and make sure that user account has sufficient permission to access the shared folder from within the web server.

2. Impersonate your application by adding the following configuration element in the web.config of your application:

<identity impersonate="true" username="theNewlyCreatedUserAccount" password="Password of the user account" />


1-将共享文件夹的读取权限提供给"" [不推荐]


2-通过在web.config文件 [不推荐]
中设置对共享位置具有读取访问权限的帐户的模拟来运行应用程序
1- Provide the read permission on the shared folder to "Everyone" [NOT RECOMMENDED]


2- Run the application by setting the impersonation of an account having read access to the shared location as following in the web.config file [NOT RECOMMENDED]

<identity impersonate="true" userName="UserName" password="MyPassword"/>




3-仅模拟访问共享文件夹的代码部分,并在完成后撤消模拟.为此,您可以检查MSDN [推荐的解决方案] http://msdn.microsoft .com/en-us/library/chf6fbt4.aspx [ ^ ]




3- Impersonate only the portion of code which is accessing the shared folder and undo the impersonation once you are done. For this you can check MSDN [RECOMMENDED SOLUTION] http://msdn.microsoft.com/en-us/library/chf6fbt4.aspx[^]


这篇关于Web服务器上的ASP.NET应用程序访问另一台服务器上的共享文件夹的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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