为什么我的文件没有任何限制,却由于权限不足而无法读取(HTTP错误500.19)? [英] Why is my file supposedly unable to be read due to insufficient permissions (HTTP Error 500.19), when it has no restrictions on it?

查看:152
本文介绍了为什么我的文件没有任何限制,却由于权限不足而无法读取(HTTP错误500.19)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试运行ASP.NET站点时(我第一次尝试使其运行)时出现此错误:

但查看所牵涉的文件(\ C:\ EnhancedSalesReporting \ customerreportingnet \ customerreportingnet \ web.config),似乎没有任何限制/权限不足:

这到底是什么问题,或者我要怎么做才能摆脱这个令人沮丧的障碍?

asp.net web.config 500.19内部服务器错误配置文件权限不足

更新

当我通过在IIS中创建虚拟目录,将其指向这些文件的位置,然后在VS中选择文件">打开网站..."来进行不同的处理时,我的表现确实更好.错误页面有所不同,但是我都被卡住了.在此处中对此障碍进行了描述.. >

更新2

当我尝试按照 Ken White 在注释中提供的链接,通过尝试在安全性"选项卡中将"IIS_IUSRS"添加到Web.Config的组或用户名,我得到"名称未找到-名为"IIS_IUSRS"的对象无法被发现... "

我会以错误的方式处理吗?无论是尝试通过Windows资源管理器还是从IIS7.5的内容视图"窗格编辑Web.Config,我都得到相同的结果-还是其他意思吗?

更新3

上面引用的该帖子的另一个提示是,"您还应该在applicationhost.config文件中检查只读属性"

这值得一试,但是哪一个呢?我的硬盘驱动器上有9个applicationhost.config文件,其中四个看起来像潜在客户,位于以下位置:

C:\Program Files (x86)\IIS Express
C:\Program Files\IIS Express
C:\Users\cshannon\MyDocuments\IIS Express
C:\Windows\System32\inetsrv

其中哪一个(如果有的话)将readonly设置为false会更好吗?

更新4

这是对迈克尔·刘的回答:

谢谢,迈克尔;

我按照您的步骤进行操作,但仍然得到相同的错误页面.我原以为它会起作用,所以我以相同的旧错误页面告终,我感到有些惊讶(甚至震惊).

顺便说一句,我在任务管理器"中没有看到详细信息"选项卡,但是在进程"选项卡中没有显示所有用户的进程".

也许是问题所在-任务管理器中有三个 w3wp.exe条目:

Image Name      User Name
----------      ---------
w3wp.exe *32    DefaultAppPool
w3wp.exe        classicEservice 
w3wp.exe        NETWORK SERVICE

应该只有一个吗?

更新5

重新启动IIS7.5后,我在任务管理器中仅获得了两个w3wp.exe条目:

w3wp.exe *32 (DefaultAppPool)
w3wp.exe (NETWORK SERVICE)

那么2个太多了吗?

UPATE 6

回答迈克尔的更新步骤:

Application Pool == classicEservice

在应用程序池"中,classicEservice的值是:

Status == Started
.NET Framework Version == v2.0
Managed Pipeline Mode == Classic
Identity == ApplicationPoolIdentity
Applications == 5

再次执行以下步骤,但是用"classicEservice"替换"DefaultAppPool"肯定会使我步入正轨,因为我不再获得500.19错误页面.现在,它已在 http://localhost/CustomerReportingNET/pages/custmaint_entry.aspx .

我认为也许应该删除"/pages/custmaint_entry.aspx";我会看到我需要做些什么来实现这一目标...

更新7

第一次沙漏"直到奶牛回家,第二次(第三次)向我显示:

更新8

我尝试了无需调试即可开始",并剥离了URL的后端,因此它只是" http://localhost/CustomerReportingNET/",但它仍然像沙漏(或者我猜是蓝色旋转的甜甜圈"),就像在能量饮料中过量使用的旋转托钵僧.

解决方案

错误由于权限不足而无法读取配置文件"表示IIS工作进程w3wp.exe在没有权限的帐户下运行访问Web.config.实际上,您的Web.config文件权限屏幕截图显示了一组非常严格的帐户.

首先,确定哪个帐户w3wp.exe的运行方式为:

  1. 在IIS管理器中,在左侧树中找到并选择您的虚拟目录.
  2. 在右侧的操作窗格中,单击基本设置.
  3. 记下已配置的应用程序池,然后单击取消.
  4. 在左侧树中选择应用程序池(应该在列表顶部附近).
  5. 在应用程序池列表中,找到您在步骤3中记下的那个,然后查看 Identity 列中的值.

IIS 7.5及更高版本(Windows 7,Windows Server 2008 R2)

我将假设已配置的应用程序池为DefaultAppPool,其标识为ApplicationPoolIdentity,这意味着

  • 安全性选项卡上,单击编辑按钮以打开权限对话框,然后单击添加 >.
  • Select Users 对话框中,单击 Locations 按钮,选择您的计算机(可能是列表中的第一项,并且是屏幕快照中的IBM-JBAKER),然后单击确定.
  • 输入要选择的对象名称文本框中, 键入 IIS APPPOOL \ DefaultAppPool (不带任何尾随空格),然后单击确定.
    • 或者,您可以通过键入 IIS_IUSRS 来授予对所有个IIS虚拟帐户的访问权限.
  • 返回 Permissions 对话框中的 Read& 允许列中的阅读复选框应已选中,因此只需单击确定.
  • IIS 6.0/7.0(Windows Vista,Windows Server 2003/2008)

    在这些操作系统上,w3wp.exe以真实"帐户(例如NETWORK SERVICE)而不是虚拟帐户运行.请按照上一节中的步骤进行操作,但是在步骤4中,将任务管理器(或 IIS_WPG )中显示的实际帐户替换为 IIS APPPOOL \ DefaultAppPool (或 IIS_IUSRS ).

    I'm getting this error when I try to run a ASP.NET site (my first time trying to get it to run):

    Yet looking at the file implicated (\C:\EnhancedSalesReporting\customerreportingnet\customerreportingnet\web.config), it doesn't seem to have any restrictions / insufficient permissons:

    What is really the problem here, or what must I do to get beyond this frustrating block?

    asp.net web.config 500.19 internalservererror configfile insufficientpermissions permissions

    UPDATE

    When I approached it differently by creating a Virtual Directory in IIS, pointing it to the location of these files, and then in VS selecting File > Open Website..., I fared no better, really. The err pages are different, but I'm stuck either way. That roadblock is described here.

    UPDATE 2

    When I attempt to follow the steps in the accepted answer in the link provided in the comment by Ken White, by trying to add "IIS_IUSRS" to Web.Config's Group or user names in the Security tab, I get "Name Not Found - An object named "IIS_IUSRS" cannot be found..."

    Am I going about this the wrong way? I get the same results whether I try to edit Web.Config via Windows Explorer or from the Content View pane in IIS7.5 - is something else meant?

    UPDATE 3

    Another hint from that post referenced above is, "You should also check for the read-only attribute in the applicationhost.config file"

    That's worth a try, but which one? I have 9 applicationhost.config files on my hard drive, and four of them look like likely prospects, those in the following locations:

    C:\Program Files (x86)\IIS Express
    C:\Program Files\IIS Express
    C:\Users\cshannon\MyDocuments\IIS Express
    C:\Windows\System32\inetsrv
    

    Which, if any, of these, would it be advantageous to set readonly to false?

    UPDATE 4

    This is in response to Michael Liu's answer:

    Thanks, Michael;

    I followed your steps, but still get the same err page. I had expected it to work, and so I was a little surprised (abashed, even) that I ended up with the same old err page.

    BTW, I saw no "Details" tab in Task Manager, but there is a "Show processes from all users" in the "Processes" tab.

    Maybe this is the problem - there are three w3wp.exe entries in Task Manager:

    Image Name      User Name
    ----------      ---------
    w3wp.exe *32    DefaultAppPool
    w3wp.exe        classicEservice 
    w3wp.exe        NETWORK SERVICE
    

    Should there be only one?

    UPDATE 5

    After restarting IIS7.5, I've got "just" two w3wp.exe entries in Task Manager:

    w3wp.exe *32 (DefaultAppPool)
    w3wp.exe (NETWORK SERVICE)
    

    So is 2 one too many?

    UPATE 6

    In answer to Michael's updated steps:

    Application Pool == classicEservice
    

    In "Application Pools" the vals for classicEservice are:

    Status == Started
    .NET Framework Version == v2.0
    Managed Pipeline Mode == Classic
    Identity == ApplicationPoolIdentity
    Applications == 5
    

    Following the steps again, but replacing "DefaultAppPool" with "classicEservice" definitely gets me on the righ track, for I no longer get the 500.19 err page. Now it is "hourglassing" on http://localhost/CustomerReportingNET/pages/custmaint_entry.aspx.

    I think maybe the "/pages/custmaint_entry.aspx" should get stripped off of that; I'll see what I need to do to accomplish that...

    UPDATE 7

    The first time it "hourglassed" until the cows came home, the second (and third) times it showed me this:

    UPDATE 8

    I tried "Start without Debugging" and stripped off the back end of the URL so that it is just "http://localhost/CustomerReportingNET/" but it still hourglasses (or "blue spinning donuts" I guess) like a whirling dervish that has overdosed on energy drinks.

    解决方案

    The error "Cannot read configuration file due to insufficient permissions" means that the IIS worker process w3wp.exe is running under an account that doesn’t have permission to access Web.config. Indeed, your screenshot of Web.config’s file permissions shows a very restrictive set of accounts.

    First, determine which account w3wp.exe is running as:

    1. In IIS Manager, find and select your virtual directory in the left tree.
    2. In the Actions pane on the right, click Basic Settings.
    3. Make a note of the configured Application pool, and then click Cancel.
    4. Select Application Pools in the left tree (it should be near the top of the list).
    5. In the list of application pools, find the one you noted in Step 3, and look at the value in the Identity column.

    IIS 7.5 and up (Windows 7, Windows Server 2008 R2)

    I’m going to assume that the configured application pool is DefaultAppPool and that its identity is ApplicationPoolIdentity, which means a virtual account is created by IIS for the application pool. (Let me know if they're something else.)

    You need to allow this virtual account to access your application folder:

    1. In Windows Explorer, open the Properties dialog box for the folder containing Web.config (C:\EnhancedSalesReporting\customerreportingnet\customerreportingnet).
    2. On the Security tab, click the Edit button to open the Permissions dialog box, and then click Add.
    3. In the Select Users dialog box, click the Locations button, select your computer (likely the first item in the list, and IBM-JBAKER from your screenshot), and then click OK.
    4. In the Enter the object names to select text box, type IIS APPPOOL\DefaultAppPool (without any trailing spaces), and then click OK.
      • Alternatively, you can grant access to all IIS virtual accounts by typing IIS_IUSRS instead.
    5. Back in the Permissions dialog box, the Read & execute and Read checkboxes in the Allow column should already be checked, so just click OK.

    IIS 6.0/7.0 (Windows Vista, Windows Server 2003/2008)

    On these operating systems, w3wp.exe runs as a "real" account (such as NETWORK SERVICE) instead of a virtual account. Follow the steps in the previous section, but in step 4, substitute the actual account shown in Task Manager (or IIS_WPG) for IIS APPPOOL\DefaultAppPool (or IIS_IUSRS).

    这篇关于为什么我的文件没有任何限制,却由于权限不足而无法读取(HTTP错误500.19)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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