IIS-拒绝访问路径 [英] IIS - Access to the path is denied

查看:255
本文介绍了IIS-拒绝访问路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题被问了上百万次,但是我尝试了这些解决方案,但仍然找不到为什么会出现此错误:

This question have been asked like million times, but I have tried those solutions and still can't find out why this error is coming up:

拒绝访问路径'\ server1 \ Folder1 \ Folder2 \ Folder3 \ file1.dwg'.

Access to the path '\server1\Folder1\Folder2\Folder3\file1.dwg' is denied.

以下是返回错误的操作:

Here is the action which returns the error:

    public ActionResult Download(string fileName)
    {
        fileName = fileName + ".dwg";
        string path = Path.Combine(@"\\server1\Folder1\Folder2\Folder3\", fileName);
        return File(path, "application/octet-stream", fileName);
    }

我尝试为多个用户名(例如"SERVER1 \ NETWORK SERVICE"-完全控制)授予"Folder3"权限.

I have tried to giving permissions to "Folder3" for multiple usernames, for example "SERVER1\NETWORK SERVICE" - Full Control.

应用程序正在默认网站"下运行.应用程序在DefaultAppPool下运行,并且DefaultAppPool的标识为"NetworkService".

Application is running under Default Web Site. Application is running under DefaultAppPool and DefaultAppPool has identity of "NetworkService".

以下代码给出了身份网络服务".

Following code gives identity "NETWORK SERVICE".

WindowsIdentity identity = HttpContext.Request.LogonUserIdentity;

该应用程序在我自己的计算机上运行正常(下载目录相同),但是在部署此问题后出现了.

The application was working fine (same download directory) on my own computer, but after deploying this problem showed up.

服务器正在运行Windows 2008 R2 SP1和IIS 7.5.

Server is running Windows 2008 R2 SP1 and IIS 7.5.

推荐答案

尝试一下:

访问路径'xxxxxx'被拒绝."

"Access to the path 'xxxxxx' is denied."

如错误所述,您需要为文件夹分配权限

As Error says You need to assign Permissions to Folders

  1. 右键单击文件夹
  2. 转到安全性"标签
  3. 单击编辑"
  4. 点击添加
  5. 点击高级
  6. 立即查找
  7. 授予IIS_IUSRS(完全控制)权限
  8. 单击确定"
  9. 单击确定"
  10. 单击允许中的Full Control
  11. 单击确定"
  12. 再次运行应用程序
  1. Right Click Folder
  2. Go to Security Tab
  3. Click on Edit
  4. Click on Add
  5. Click on Addvance
  6. Find Now
  7. Give Permission to IIS_IUSRS (Full Control)
  8. Click On OK
  9. Click On OK
  10. Click On Full Control in allow
  11. Click On OK
  12. Again Run the Application

注意::如果上述操作均无效,请尝试授予相同的权限 NETWORKNETWORK SERVICE用户

Note: If Above things are not working then try to give same permission to NETWORK,NETWORK SERVICE Users

这篇关于IIS-拒绝访问路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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