Windows 身份验证在 IIS Express 中不起作用,使用 Visual Studio 2013、Windows 8 进行调试 [英] Windows Authentication not working in IIS Express, debugging with Visual studio 2013, Windows 8

查看:14
本文介绍了Windows 身份验证在 IIS Express 中不起作用,使用 Visual Studio 2013、Windows 8 进行调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚将我的应用程序从 Visual Studio 2012 升级到 Visual Studio 2013.我的 Windows 身份验证不再起作用.它给了我以下错误.

I just upgraded my application from Visual studio 2012 to Visual studio 2013. My windows authentication is not working any more. It is giving me below error.

     HTTP Error 401.2 - Unauthorized
     You are not authorized to view this page due to invalid authentication headers.

在 Visual Studio 中,可以选择从网站属性本身中选择身份验证.所以我禁用了匿名访问并启用了 Windows 身份验证,但它要求我输入用户名和密码,如下所示.即使我在这里提供域凭据.它仍然一次又一次地给我这个弹出窗口.

In visual studio there is option to select authentication from website properties itself. So I disabled anonymous access and enable windows authentication but it is asking me for username and password as below popup. Even if I give domain credentials here. Its is still giving me this popup again and again.

网络配置:

     <authentication mode="Windows" />
     <authorization>
     <deny users="?" />
     </authorization>
     <identity impersonate="false" />
     <trace enabled="true" />

IIS Express aspnetConfig:

     <authentication>

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

            <basicAuthentication enabled="false" />

            <clientCertificateMappingAuthentication enabled="false" />

            <digestAuthentication enabled="false" />

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

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

        </authentication>

        <authorization>
            <add accessType="Allow" users="*" />
        </authorization>



        <location path="Path">
        <system.webServer>
        <security>
            <authentication>
                <windowsAuthentication enabled="true" />
                <anonymousAuthentication enabled="false" />
            </authentication>
        </security>
        </system.webServer>
        </location>

如果您想了解更多详情,请告诉我.

Let me know if you want more details on this.

更新:

我发现如果我从 web.config 中删除以下行,它就会开始工作.

I found out that if I remove below line from web.config than it start working.

     <remove users="*" roles="" verbs="" />

推荐答案

注意 applicationhost.config 修改 - 在 Visual Studio 2015 中我发现它有时 驻留在本地项目目录中.

Be careful with the applicationhost.config modifications - in Visual Studio 2015 I've found that it sometimes resides in the local project directory.

例如:

DRIVE:MYPROJECT.vsconfigapplicationhost.config

如果您不确定正在使用哪个应用程序主机配置文件,您可以使用 ProcMon & 监控文件访问.然后根据路径"缩小结果范围,以查看 VS 在调试时实际读取的内容.

If you're not sure which applicationhost config file is being used, you can monitor file access with ProcMon & then narrow down the results based on "Path" to see what VS is actually reading at Debug time.

更新:这似乎也是 Visual Studio 2017 中的行为.

Update: This appears to be the behavior in Visual Studio 2017 as well.

这篇关于Windows 身份验证在 IIS Express 中不起作用,使用 Visual Studio 2013、Windows 8 进行调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆