如何修复错误“访问被拒绝的路径”在IIS中的托管应用程序中 [英] How to fix an error "access to the path denied" in the hosted application in IIS

查看:77
本文介绍了如何修复错误“访问被拒绝的路径”在IIS中的托管应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序涉及删除文件并将新创建的文件移动到已删除的文件路径。当我在本地运行它时,它正常工作,我在我的本地iis中托管该应用程序,但是当涉及到文件的删除功能时,它给我一个错误。



错误消息:

拒绝访问文件路径路径。



我尝试过:



1)我已经为文件安全属性添加了具有FullControl访问权限的IIS_IUSRS标识。

2)启用了目录浏览我当地的iis服务器。



但没有运气。我得到了同样的错误。请给我一些建议。在此先感谢。

My application involves in deleting a file and moving the newly created file to the deleted file path. It is properly working when i am running it locally, I hosted that application in my local iis but it is throwing me an error when it comes to the delete functionality of the file.

Error Message:
Access to the path 'File Path' is denied.

What I have tried:

1) I have added IIS_IUSRS identity with FullControl access for the file security property.
2) Enabled the Directory Browsing in my local iis server.

but no luck. I am getting the same error. Please suggest me something. Thanks in advance.

推荐答案

当您应该授予文件所在文件夹的权限时,似乎您正在授予文件本身的权限。



如前所述,您应该创建一个用户帐户来运行您的网站所托管的应用程序池。此ID应被授予执行任何代码的权限需要包含您正在使用的文件的文件夹。



这些权限不应在您的网站代码中授予。应用程序部署到服务器时应该设置它们。
It would appear as though you're granting permissions to the files themselves when you should be granting permissions to the folder the files are in.

As has been said before, you should be creating a user account to run the app pool your site is hosted in. This ID should be granted permissions to do whatever the code needs to the folder containing the files you're working with.

These permissions should NOT be granted in your website code. They should be setup when the application is deployed to the server.


首先使用调试器 - 或者如果你只是在生产中进行记录 - 来确切地找出路径是什么,以及然后看看需要什么权限。



但我猜你正试图访问客户端硬件并删除/移动文件到它上面。这不起作用 - 它似乎在开发中,因为客户端和服务器都是同一台计算机,但在生产中它们不是,并且服务器(运行VB代码的地方)根本无法访问客户端硬件,所以你收到错误信息。

找出实际路径是重要的一点,但是。
Start by using the debugger - or logging if you only get this in production - to find out exactly what the path is, and then look at what needs permissions.

But I'm guessing that you are trying to access the client hardware and delete / move a file onto it. That won't work - it seems to in development because the client and the server are both the same computer, but in production they aren't, and the server (which is where your VB code is run) has no access at all to client hardware, so you are getting the error message.
Finding out the actual path is the important bit to start with though.


我建​​议你改变它IIS中的应用程序池的标识,以使用您授予足够权限的本地帐户,而不是像您已经使用的那样构建的帐户。只需创建一个新帐户并授予其权限。



还要确保您没有在Web.Config中使用Impersonate标记。
I would suggest you change the identity of the application pool in IIS to use a local account that you grant sufficient permissions to, not one that is built in like you already did. Just create a new account and give it permissions.

Also make sure you are not using the Impersonate tag in Web.Config.


这篇关于如何修复错误“访问被拒绝的路径”在IIS中的托管应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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