【发布时间】:2016-10-01 05:49:07
【问题描述】:
我有一个类似的问题:
URL authorization failed for the request
IIS File authorization failed for the request
我在 IIS 7 上运行几个类似的网站。我正在使用 Firefox 进行测试,这样我就可以充当我以外的用户。
我一直在站点 1 上完成所有工作。我可以以网络用户 administrator 和 sys\bob 的身份登录。
我现在在站点 2 和 3 上工作。我可以使用 administrator 登录就好了。问题是:当我以dom\bob 登录时,初始登录已正确验证。在所有后续请求中,dom\bob 会因文件或 URL 身份验证失败而被拒绝。
应用程序事件日志条目与链接问题中引用的条目基本相似,只是自定义事件详细信息部分为空。
我在 IIS 管理器中检查了网站,到目前为止没有发现任何差异。我已经确认 web.config 文件是相同的,除了特定于站点的信息,例如连接字符串。据我所知,我已经验证文件夹权限是正确的。
特别是关于权限:
<authentication> 模式在所有网站上都是Windows。
特别是<authorization> 节点在网站之间是相同的。
在所有情况下,本地域都是相同的 MS Windows Server 2008 虚拟机——一个服务器映像托管多个网站。所以理论上,所有网站的用户授权应该是相同的。
--编辑 1-- 只是我的运气。我在网站 1 上弹出了这个授权问题,在一个之前运行良好的 JavaScript 文件上,在 sprint 审查期间。在这种情况下,用户可以在授权失败之前浏览相当多的页面。
我会尽快发布我的日志。
--编辑 2-- 在此问题开始之前不久,我确实对环境进行了一次更改:我更新了 jQuery 和 Bootstrap。
这是我在 packages.config 中的差异:
之前
<package id="AspNet.ScriptManager.bootstrap" version="3.3.5" targetFramework="net45" />
<package id="AspNet.ScriptManager.jQuery" version="2.1.4" targetFramework="net45" />
<package id="bootstrap" version="3.3.5" targetFramework="net45" />
<package id="jQuery" version="2.1.4" targetFramework="net45" />
之后
<package id="AspNet.ScriptManager.bootstrap" version="3.3.6" targetFramework="net45" />
<package id="AspNet.ScriptManager.jQuery" version="2.2.3" targetFramework="net45" />
<package id="bootstrap" version="3.3.6" targetFramework="net45" />
<package id="jQuery" version="2.2.3" targetFramework="net45" />
这是应用程序事件日志中的两个典型条目,经过适当清理。
1:
Event code: 4008
Event message: File authorization failed for the request.
Event time: 6/2/2016 2:31:29 PM
Event time (UTC): 6/2/2016 6:31:29 PM
Event ID: e4a0fd65d9e34686967f14429d21ab97
Event sequence: 14
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/21/ROOT-1-131093658656731243
Trust level: Full
Application Virtual Path: /
Application Path: C:\Users\Administrator\Documents\Visual Studio 2013\Projects\HAWK_WebForms\HAWK.Web.LogansRun\
Machine name: BAH01
Process information:
Process ID: 5288
Process name: iisexpress.exe
Account name: HAWK\administrator
Request information:
Request URL: http://localhost:53104/Scripts/jquery-2.2.3.js
Request path: /Scripts/jquery-2.2.3.js
User host address: ::1
User: HAT\john.smith
Is authenticated: True
Authentication Type: NTLM
Thread account name: HAWK\administrator
Custom event details:
2:
Event code: 4008
Event message: File authorization failed for the request.
Event time: 6/2/2016 2:28:51 PM
Event time (UTC): 6/2/2016 6:28:51 PM
Event ID: a43d7292a8894df193600e829e74c696
Event sequence: 14
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/14/ROOT-1-131093657141125131
Trust level: Full
Application Virtual Path: /
Application Path: C:\Users\Administrator\Documents\Visual Studio 2013\Projects\HAWK_WebForms\HAWK.Web.LogansRun\
Machine name: BAH01
Process information:
Process ID: 5248
Process name: iisexpress.exe
Account name: HAWK\administrator
Request information:
Request URL: http://localhost:53752/Scripts/Pages/Admin/SelfRatingWizard.js
Request path: /Scripts/Pages/Admin/SelfRatingWizard.js
User host address: ::1
User: HAWK\james.jones
Is authenticated: True
Authentication Type: NTLM
Thread account name: HAWK\administrator
Custom event details:
--编辑3--
我尝试从这个答案添加注册表项:https://stackoverflow.com/a/13015279/2615836
它没有改变任何东西。我还仔细检查了身份验证提供程序的顺序。 NTLM 已经领先于所有网站的协商。
--另一个更新--
我回滚了 Bootstrap 和 jQuery。令我惊讶的是,文件授权仍然失败!同样,jQuery.js 是一个地方——几乎每个文件都会提出这个投诉。好像授权令牌被“遗忘”了。
--更新到编辑 1--
在网站 1 中引发问题的 JavaScript 文件没有 Network Service 的权限,就像所有其他 JavaScript 文件一样。一旦我解决了这个问题,网站 1 就解决了。唉,这个修复没有解决网站 2。
【问题讨论】:
-
我已经运行
iisreset并重新启动了 VM。两种尝试都没有解决问题。
标签: asp.net iis authorization windows-authentication