gpt4 book ai didi

c# - 为什么在我将项目发布到服务器后 IIS 匿名身份验证会自行打开?

转载 作者:太空狗 更新时间:2023-10-30 01:03:05 24 4
gpt4 key购买 nike

我的 ASP.NET 站点出现奇怪的问题。我的站点使用 Windows 身份验证,并且我在 IIS 服务器上设置了身份验证选项以拒绝匿名身份验证。但是,每当我将我的项目上传到 IIS 服务器时,我网站的匿名身份验证会自行打开。

这是我的 applicationHost.config。注意匿名认证在这里设置为false,但每次我发布我的网站时,它会自动更改为true,我必须登录到网络服务器并手动将其更改回来。

<location path="[my root folder]">
<system.webServer>
<security>
<authentication>
<windowsAuthentication enabled="true" />
<anonymousAuthentication enabled="false" />
<basicAuthentication enabled="false" realm="" defaultLogonDomain="[my domain]" />
</authentication>
</security>
</system.webServer>
</location>

这是我的 web.config

<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" maxRequestLength="102400" executionTimeout="3600" requestLengthDiskThreshold="102400"/>
<authentication mode="Windows" />
<authorization>
<deny users="?" />
</authorization>
<customErrors mode="On" defaultRedirect="[my error page]"/>
</system.web>

过去,我使用以下设置允许对 1 个特定子文件夹进行匿名身份验证

<location path="[my sub folder]">
<system.webServer>
<security>
<authentication>
<windowsAuthentication enabled="false" />
<anonymousAuthentication enabled="true" />
</authentication>
</security>
</system.webServer>
</location>

<location path="[my sub folder]">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>

但是我不再使用该设置。

最佳答案

经过几天的摸索,终于找到了原因。事实证明,虽然我确实为我的个人站点禁用了匿名身份验证,但我忘记了在服务器范围内关闭匿名身份验证。如果有人遇到同样的错误,这是我用来解决它的步骤:

  • 打开 IIS 控制面板。
  • 在左侧的 TreeView 中,选择您的服务器名称而不是您的个人站点。
  • 在右侧新打开的面板中,双击IIS下的认证
  • 右键单击匿名身份验证并选择禁用。

关于c# - 为什么在我将项目发布到服务器后 IIS 匿名身份验证会自行打开?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30726064/

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