Skip to main content
 首页 » 编程设计

c#之MVC windows 身份验证在项目属性中变灰(变灰)

2024年08月12日32落叶

我正在尝试在最初在 VS2011 中完成的 VS 2013、MVC 4 项目中使用 Windows 身份验证。

它在 VS2011 上运行良好,但当我在同一台机器上移动到 VS2013 时,使用 IIS 7 问题接踵而至。

我在 web.config 中设置了 Windows 身份验证(并且禁用了匿名身份验证):

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

但是,这些属性在VS2013解决方案的“f4”属性窗口中是灰色的(greyed)。

当我调试程序时,出现以下错误:

HTTP Error 500.19 - Internal Server Error with Error Code 0x80070021

我已尝试根据论坛中的类似帖子编辑 C:\Windows\System32\inetsrv\config applicationHost.config,并重新启动服务,但问题仍然存在。

有谁知道如何解决这个问题吗?

提前致谢。

请您参考如下方法:

对我有用的是 web.config 中的以下行 -->

<system.web> 
    <authentication mode="Windows" /> 
</system.web>