IIS Express HTTP 错误 401.2 - 未经授权

发布于 2024-11-02 11:11:30 字数 1861 浏览 3 评论 0原文

我已尝试这篇文章中的建议,但我无法在 IIS Express 中使用 Windows 身份验证Vision Studio 2010。现在我收到以下错误: 401.2 Error

以下是我的 applicationhost.config 文件条目:

...
<add name="WindowsAuthenticationModule" lockItem="false" />
...
<authentication>

    <anonymousAuthentication enabled="true" userName="" />

    <basicAuthentication enabled="false" />

    <clientCertificateMappingAuthentication enabled="false" />

    <digestAuthentication enabled="false" />

    <iisClientCertificateMappingAuthentication enabled="false">
    </iisClientCertificateMappingAuthentication>

    <windowsAuthentication enabled="true" />
</authentication>
...
<sectionGroup name="authentication">
    <section name="anonymousAuthentication" overrideModeDefault="Allow" />
    <section name="basicAuthentication" overrideModeDefault="Allow" />
    <section name="clientCertificateMappingAuthentication" overrideModeDefault="Allow" />
    <section name="digestAuthentication" overrideModeDefault="Allow" />
    <section name="iisClientCertificateMappingAuthentication" overrideModeDefault="Allow" />
    <section name="windowsAuthentication" overrideModeDefault="Allow" />
</sectionGroup>

我的 web.config:

<system.web>
    <authentication mode="Windows" /> 
</system.web>
<system.webServer>
    <security>
        <authentication>
            <anonymousAuthentication enabled="false" />
            <windowsAuthentication enabled="true" />        
        </authentication>
    </security>
</system.webServer>

这是 .NET 4

I have tried the suggestions in this post but I can not get Windows Authentication working with IIS Express in Vision Studio 2010. Now I get following error:
401.2 Error

Here are my applicationhost.config file entries:

...
<add name="WindowsAuthenticationModule" lockItem="false" />
...
<authentication>

    <anonymousAuthentication enabled="true" userName="" />

    <basicAuthentication enabled="false" />

    <clientCertificateMappingAuthentication enabled="false" />

    <digestAuthentication enabled="false" />

    <iisClientCertificateMappingAuthentication enabled="false">
    </iisClientCertificateMappingAuthentication>

    <windowsAuthentication enabled="true" />
</authentication>
...
<sectionGroup name="authentication">
    <section name="anonymousAuthentication" overrideModeDefault="Allow" />
    <section name="basicAuthentication" overrideModeDefault="Allow" />
    <section name="clientCertificateMappingAuthentication" overrideModeDefault="Allow" />
    <section name="digestAuthentication" overrideModeDefault="Allow" />
    <section name="iisClientCertificateMappingAuthentication" overrideModeDefault="Allow" />
    <section name="windowsAuthentication" overrideModeDefault="Allow" />
</sectionGroup>

My web.config:

<system.web>
    <authentication mode="Windows" /> 
</system.web>
<system.webServer>
    <security>
        <authentication>
            <anonymousAuthentication enabled="false" />
            <windowsAuthentication enabled="true" />        
        </authentication>
    </security>
</system.webServer>

This is .NET 4

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

小耗子 2024-11-09 11:11:30

确保您的 applicationhost.config 文件中有类似下面的内容

<windowsAuthentication enabled="true">
  <providers>
    <add value="Negotiate" />
    <add value="NTLM" />
   </providers>
</windowsAuthentication>

该文件可能位于 %HOMEPATH%\Documents\IISExpress\config\

Make sure you have something like below in your applicationhost.config file

<windowsAuthentication enabled="true">
  <providers>
    <add value="Negotiate" />
    <add value="NTLM" />
   </providers>
</windowsAuthentication>

This file is probably in %HOMEPATH%\Documents\IISExpress\config\

水溶 2024-11-09 11:11:30

当我想更新服务参考时,我在使用 IIS 8.0 Express 的 VS 2013 中遇到了这样的问题。弹出一个对话框,要求输入用户名/密码。服务 url 中添加了一个奇怪的子字符串:

_vti_bin/ListData.svc

我开始配置 Windows 身份验证,如本页 applicationhost.config 中的一些帖子中所述。最后,工作配置不能有 Negotiate 提供程序:

<windowsAuthentication enabled="true">
  <providers>
    <!--<add value="Negotiate" />-->
    <add value="NTLM" />
   </providers>
</windowsAuthentication>

并且必须禁用匿名身份验证:

<anonymousAuthentication enabled="false" />
<windowsAuthentication enabled="true" />

I've had such a problem in VS 2013 with IIS 8.0 Express when I wanted to update Service Reference. A dialog popped up asking for username/password. A strange substring was added to the service url:

_vti_bin/ListData.svc

I started configuring windows authentization as mentioned in some posts in this page in applicationhost.config. Finally, the working configuration can't have Negotiate provider:

<windowsAuthentication enabled="true">
  <providers>
    <!--<add value="Negotiate" />-->
    <add value="NTLM" />
   </providers>
</windowsAuthentication>

And the anonymous authentication must be disabled:

<anonymousAuthentication enabled="false" />
<windowsAuthentication enabled="true" />
离鸿 2024-11-09 11:11:30

尝试将以下内容添加到您的 web.config 中。

<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />
    <security>
        <authentication>
            <windowsAuthentication enabled="true" />
        </authentication>
    </security>
</system.webServer>

Try adding the following to your web.config.

<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />
    <security>
        <authentication>
            <windowsAuthentication enabled="true" />
        </authentication>
    </security>
</system.webServer>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文