如何配置Windows身份验证/模拟+ IIS 7 + MVC [英] How to configure Windows Authentication / Impersonation + IIS 7 + MVC

查看:134
本文介绍了如何配置Windows身份验证/模拟+ IIS 7 + MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台运行IIS 7的Windows 2008服务器,我正在尝试配置Windows身份验证和ASP.NET模拟,特别是针对使用MVC的Intranet站点.当用户从IE中访问该网站时,他们将使用捕获的Windows用户名自动登录到我们的网站.

I have a Windows 2008 server running IIS 7 and I'm trying to configure Windows Authentication and ASP.NET Impersonation, specifically for an intranet site which uses MVC. When a user hits the site from IE they are automatically logged to our site using the captured Windows username.

我可以使用IIS 6进行所有工作:

I have everything working in IIS 6 with:

  • 关闭匿名访问
  • 集成了Windows身份验证,并且:

  • Anonymous access off
  • Integrated Windows Authentication on, and:

<identity impersonate="true"/> in the web.config.

在IIS 7中,即使在经典模式下,我似乎也无法正常工作.

In IIS 7, I can't seem to get it working, even in classic mode.

在IIS 7中对网站进行身份验证下,我启用了Windows身份验证和ASP.NET模拟,而所有其他功能均被禁用.当我在本地访问该网站时,它可以工作.从远程计算机(在同一域中,使用IE,使用计算机名称即http://servername/site/将其作为Intranet站点加载),我的Windows凭据受到挑战.即使我输入了有效的Windows凭据,它也会失败,并且单击取消"会给我一个HTTP错误401,请求的资源需要用户身份验证".

Under Authentication for the site in IIS 7, I have Windows Authentication and ASP.NET Impersonation enabled, everything else disabled. When I hit the site locally, it works. From a remote machine (on the same domain, using IE, loading it as an intranet site using the machine name i.e. http://servername/site/) I get challenged for my Windows credentials. Even if I enter in valid Windows credentials it fails, and clicking cancel gives me a HTTP Error 401, "The requested resource requires user authentication".

转动ASP.NET模拟无法解决任何问题.有什么建议吗?

Turning ASP.NET Impersonation does not help anything. Any suggestions?

推荐答案

原来的问题是服务器已失去与域的连接.我尝试使用域用户帐户而不是本地管理员将桌面远程访问计算机,但出现错误:

The problem turned out to be that the server had lost connection with the domain. I tried to remote desktop into the machine using my domain user account instead of a local admin, and I got the error:

此工作站与主域之间的信任关系失败.

The trust relationship between this workstation and the primary domain failed.

我从域中删除了计算机,然后将其重新添加,然后Windows身份验证和ASP.NET模拟都可以正常工作.

I remove the machine from the domain and re-added it, and after that both Windows Authentication and ASP.NET Impersonation work correctly.

这篇关于如何配置Windows身份验证/模拟+ IIS 7 + MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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