asp.net - 是否需要授予应用程序池身份对Web文件夹的读取权限?

标签 asp.net asp.net-mvc iis asp.net-mvc-3 iis-7.5

我始终授予应用程序池身份对 Web 文件夹的只写权限。

但是,有些人授予他们读写权限。

问题是

Is it necessary to grant an application pool identity a read permission on the web folder? Does granting a write permission suffice?

编辑 1

到目前为止,我授予只写权限没有遇到任何问题。

您能举一个需要读取权限的案例吗?

编辑2

我在 App_Data 文件夹中有一个 data.txt,在我的操作方法中,我的代码如下:

        using (StreamReader sr = new StreamReader(Server.MapPath("~/App_Data/data.txt")))
        {
            string text = sr.ReadToEnd();
            // do more things here.
        }

到目前为止一切顺利。

编辑3

我有一个文件夹Content,其中包含一堆 pdf 文件。用户仍然可以下载它们。

最佳答案

这里写得很好:Why can I upload a file without IIS Write Permission?

  • "Read" access controls whether the HTTP GET verb is allowed.

  • "Write" access controls whether HTTP PUT verb is allowed.

关于asp.net - 是否需要授予应用程序池身份对Web文件夹的读取权限?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5255752/

相关文章:

c# - Jabber 作为 asp.net 网站的聊天系统

c# - ASP.NET 最干净的方法使跨应用程序的缓存无效

c# - 我的数据源不支持删除?我怎样才能激活它?

asp.net-mvc - 如何将 NPM 包与现有 C#/MVC 项目一起使用以在 Azure 上进行 git 部署?

jquery - 未捕获的语法错误 : Unexpected token ILLEGAL. Html.Partial()

asp.net-mvc - 检查用户是否仍然登录而不重置身份验证超时

asp.net - 应用程序池标识或模拟

asp.net - 解析器错误 : Could not load type after changing output dir in asp. 网络应用程序

apache - 让 Apache 将 http 请求路由到 IIS

c# - 对 IIS 站点的第一次请求总是产生 500.21 错误