gpt4 book ai didi

asp.net - 为匿名用户授权目录 IIS 7.5?

转载 作者:行者123 更新时间:2023-12-04 14:51:39 26 4
gpt4 key购买 nike

我正在尝试在 IIS 7.5 中添加一个用于匿名访问的目录。它适用于 Web Dev 但不适用于 IIS 7.5

我目前在目录中使用这个 web.config。这是一个带有样式表的目录:

<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->

<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<authorization>

<allow users="*" />

</authorization>

</system.web>
</configuration>

更新:

我已经转到文件夹并在身份验证下,我已将匿名身份验证从 IIS_USR 更改为池。这似乎纠正了它。

我会奖励任何为理解此设置提供非常好的解释和资源的人。此外,了解如何在全局范围内应用它也很重要——适用于所有文件夹。

最佳答案

由于您回答了自己的问题,因此这里的解释可能会有所帮助

授权处理 IIS 将向谁提供资源。但是,这些资源具有自己的安全性,因为它们只是文件系统上的文件。

配置中的 Authentication 元素有助于确定 IIS 在接受用户请求后以及访问 IIS 之外/外部资源时如何识别用户请求。

这是在站点级别设置的,通常在服务器的 applicationHost.config 文件中。如果设置正确,它可以在站点级别被覆盖。

关于此的 IIS.net 页面:

http://www.iis.net/ConfigReference/system.webServer/security/authorization/add

http://www.iis.net/ConfigReference/system.webServer/security/authentication/anonymousAuthentication

您在 UI 中所做的 .config 版本是:

<location path="/yourSite">
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="true" username="" />
</authentication>
</security>
</system.webServer>
</location>

在匿名。 auth 方法,用户名字段是 IIS 将在访问资源时模拟的人。当您不指定时,它默认使用应用程序池的标识。

现在,至于为什么这很重要......检查磁盘上的实际文件(.css)。如果这解决了问题,则意味着 IUSR 无权读取该文件。

关于asp.net - 为匿名用户授权目录 IIS 7.5?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4901587/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com