小编gzu*_*zup的帖子

我将项目发布到服务器后,IIS匿名身份验证自行启用

我的ISP .NET站点有一个奇怪的问题.我的站点使用Windows身份验证,我在IIS服务器上设置了身份验证选项以拒绝匿名身份验证.但是,每当我将项目上传到IIS服务器时,我的站点的匿名身份验证就会自动启动.

这是我的applicationHost.config,注意此处匿名身份验证设置为false,但每次我发布我的网站时,它都会自动更改为true,我必须登录到Web服务器并手动将其更改回来.

<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>
Run Code Online (Sandbox Code Playgroud)

这是我的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]"/>
Run Code Online (Sandbox Code Playgroud)

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

<location path="[my sub folder]">
    <system.webServer>
        <security>
            <authentication>
                <windowsAuthentication enabled="false" />
                <anonymousAuthentication enabled="true" />
            </authentication>
        </security>
    </system.webServer>
</location>
Run Code Online (Sandbox Code Playgroud)

<location path="[my sub folder]">
<system.web>
  <authorization>
    <allow users="*" />
  </authorization>
</system.web> …
Run Code Online (Sandbox Code Playgroud)

c# asp.net authentication iis

4
推荐指数
1
解决办法
1453
查看次数

标签 统计

asp.net ×1

authentication ×1

c# ×1

iis ×1