当我在 IIS 上托管我的 ASP.NET MVC 项目时,Windows 身份验证效果很好.但是如果我从 Visual Studio 运行它 - 它不会.
Windows authentication works good when I host my ASP.NET MVC project on IIS. But if I run it from Visual Studio - it doesn't.
这是我的 Web.config:
Here is my Web.config:
<authentication mode="Windows" /> <authorization> <deny users="?" /> </authorization>我错过了什么吗?
推荐答案如果您在 IIS Express 中托管(您可能应该这样做),请确保您已在 Web 应用程序的属性中启用 Windows 身份验证.
If you are hosting in IIS Express (which you probably should), make sure you have enabled Windows Authentication in the properties of your Web Application.
顺便说一下,如果您使用 Intranet 应用程序模板在 Visual Studio 中创建新的 ASP.NET MVC 4 应用程序,您将在屏幕上看到以下自述文件.所以继续尝试,阅读它并按照那里写的内容进行操作:
By the way if you create a new ASP.NET MVC 4 application in Visual Studio using the Intranet Application template you will be greeted with the following Readme on the screen. So go ahead, try it, read it and follow what's written there:
要在 Windows Azure 身份验证中使用此模板,请参阅go.microsoft/fwlink/?LinkID=267940.
To use this template with Windows Azure authentication, refer to go.microsoft/fwlink/?LinkID=267940.
否则,要将此模板用于 Windows 身份验证,请参阅以下说明:
Otherwise, to use this template with Windows authentication, refer to the instructions below:
在 IIS Express 上托管:
Hosting on IIS Express:
在 IIS 7 或更高版本上托管:
Hosting on IIS 7 or later:
在 Windows 上启用 Windows 身份验证:
To enable Windows authentication on Windows:
a) 在控制面板中打开程序和功能".b) 选择打开或关闭 Windows 功能".c) 导航到 Internet 信息服务 > 万维网服务 > 安全性并确保选中 Windows 身份验证节点.
a) In Control Panel open "Programs and Features". b) Select "Turn Windows features on or off". c) Navigate to Internet Information Services > World Wide Web Services > Security and make sure the Windows authentication node is checked.
在 Windows Server 上启用 Windows 身份验证:
To enable Windows authentication on Windows Server:
a) 在服务器管理器中,选择 Web 服务器 (IIS) 并单击添加角色服务.b) 导航到 Web Server > Security 并确保选中 Windows 身份验证节点.
a) In Server Manager, select Web Server (IIS) and click Add Role Services. b) Navigate to Web Server > Security and make sure the Windows authentication node is checked.
更多推荐
当我从 Visual Studio 运行项目时,Windows 身份验证不起作用
发布评论