401 - Unauthorized: Access is denied due to invalid credentials.
·
401 - Unauthorized: Access is denied due to invalid credentials.
IIS7及以上 有时会遇到 401 - Unauthorized: "Access is denied due to invalid credentials"错误
背景:同时启用了IIS网站应用程序“身份验证”的“匿名访问” 和 “集成windows身份验证”。 I want authentication mode "Windows Authentication" and "Anonymous Authentication" .
“HTTP Error 401.1 - Unauthorized:Access is denied due to invalidcredentials”(HTTP 错误 401.1 - 未授权: 由于凭据无效,访问被拒绝)
解决方案:
最简单的方法就是退回使用早期IIS的 “Network Service” 作为 应用程序池标识,而不是使用IIS 7.5默认使用的 “ApplicationPoolIdentity” 。 然后重启整个IIS服务(或者直接重启服务器)。
Solution: change application pool from ApplicationPoolIdentity to NetworkService.
如果该解决方案无效,那么很可能是 C#.Net 网站代码中,web.config 文件中没有配置启用 匿名验证 (只启用了Windows身份验证<NT>)
<add key="WebLoginEnable" value="true" /> <add key="NTLoginEnable" value="true" />
Solution 2:
Issue solved:
1. Open iis and select the website that is causing the 401
2. Open the “Authentication” property under the “IIS” header
3. Click the “Windows Authentication” item and click “Providers”
4. Move 【NTLM】 at top and BAM that's fixed it.
Solution 3:
1. Open IIS and select the website that is causing the 401
2. Open the "Authentication" property under the "IIS" header
3. Right Click the "Anonymous Authentication" item and click "Edit"
4. Select "Application Pool Identity" in popup
5. Click OK
Solution 4:
Another solution to the above error is; 1. Open IIS Manager and select the website that is causing the 401 2. Open the "Authentication" property under the "IIS" header 3. Click the "Windows Authentication" item and click "Advanced Settings" from the right 4. Set "Extended Protection" to "OFF"
Solution 5:
Right click on folder and choose Properties.
In Security tab add ‘IUSER’ and 'NETWORK SERVICE' and give full control to both user.
扩展资料:
IIS匿名访问的操作 文件夹权限(IIS_IUSRS、Authenticated Users两个任选一个)
·
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】