IIS Express Windows 身份验证

问题描述 投票:0回答:2

我正在尝试将 IIS Express 与 VS2010 一起使用来托管 silverlight 应用程序。我修改了 applicationhost.config 文件以允许修改正确的配置设置。我的 web.config 中有以下内容:

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

我未经过身份验证,并且我的域服务调用以用户身份返回空记录。在安装 VS2010 SP1 BETA 后我能够让它工作,但我试图让它仅与 IIS Express 一起工作。

如何启用 Windows 身份验证以与 IIS Express 配合使用。是否有我缺少的配置设置?

visual-studio-2010 visual-studio windows-authentication iis-express
2个回答
411
投票

Visual Studio 2010 SP1 和 2012 添加了对 IIS Express 的支持,无需编辑尖括号。

  1. 如果您还没有这样做,请右键单击 Web 风格的项目并选择“使用 IIS Express...”。
  2. 完成后,选择 Web 项目并按 F4 聚焦“属性”面板。
  3. 将“Windows 身份验证”属性设置为“启用”,并将“匿名身份验证”属性设置为“禁用”。

enter image description here

我相信这个解决方案优于 vikomall 的选择。

  • 选项 #1 是对所有 IIS Express 站点的全局更改。
  • 选项 #2 在 web.config 中留下了开发痕迹。
    • 此外,部署到 IIS 7.5 时可能会导致错误,除非您按照 IIS 服务器的 applicationHost.config 上的“解锁”过程进行操作。

上面基于 UI 的解决方案使用 IIS Express 的 applicationHost.config 中特定于站点的位置元素,使应用程序保持不变。

更多信息在这里: http://msdn.microsoft.com/en-us/magazine/hh288080.aspx


280
投票

选项-1

编辑

\My Documents\IISExpress\config\applicationhost.config
文件并启用 windowsAuthentication,即:

<system.webServer>
...
  <security>
...
    <authentication>
      <windowsAuthentication enabled="true" />
    </authentication>
...
  </security>
...
</system.webServer>

选项-2

解锁 \My Documents\IISExpres 中的 windowsAuthentication 部分

© www.soinside.com 2019 - 2024. All rights reserved.