简体   繁体   English

IIS 7.5中未启用Windows身份验证

[英]Windows Authentication not getting enabled in IIS 7.5

I am just starting to learn ASP.NET. 我刚刚开始学习ASP.NET。 I opened a default ASP.NET application and changed the web.config file to enable Windows authentication. 我打开了一个默认的ASP.NET应用程序并更改了web.config文件以启用Windows身份验证。

<authentication mode="Windows">
</authentication>

When I run from VS using the asp.net development server, it is able to detect my windows login and display it. 当我使用asp.net开发服务器从VS运行时,它能够检测我的Windows登录并显示它。 I tried publishing it to the IIS server 7.5 in the same PC and ran from there. 我尝试将它发布到同一台PC中的IIS服务器7.5并从那里运行。 Now my windows login is not getting detected. 现在我的Windows登录没有被检测到。 I have enabled the Windows Authentication from the Authentication feature in IIS. 我已从IIS中的身份验证功能启用了Windows身份验证。 What else I might be missing in this case? 在这种情况下我还可能缺少什么?

Thanks.. 谢谢..

Try disabling Anonymous Authentication in IIS 7.5 for that web-site. 尝试在IIS 7.5中为该网站禁用匿名身份验证。

  • Open IIS Console. 打开IIS控制台。
  • Select website. 选择网站。
  • Double-click "Authentication" 双击“身份验证”
  • Ensure "Anonymous Authentication" is disabled 确保禁用“匿名身份验证”

Only "Windows Authentication" should be enabled for your purposes. 只应为您的目的启用“Windows身份验证”。

The reason this works is that a browser will perform the first request anonymously. 这样做的原因是浏览器将匿名执行第一个请求。 If anonymous authentication is enabled this request will succeed, and so the web-server will have no idea who you are. 如果启用了匿名身份验证,则此请求将成功,因此Web服务器将不知道您是谁。

If you use a tool like Fiddler to examine the network traffic between you and the server, you will notice that you actually get 3 requests if Windows Authentication is the only configured method. 如果您使用像Fiddler这样的工具来检查您和服务器之间的网络流量,您会注意到如果Windows身份验证是唯一配置的方法,您实际上会收到3个请求。 The requests get the following responses: 请求得到以下响应:

  • Request 1: "Please can I log-in anonymously?" 请求1:“我可以匿名登录吗?”
  • Response 1: "NO!!!" 回应1:“不!” [HTTP Status Code 401] [HTTP状态码401]
  • Request 2: "Alright, what do you support?" 请求2:“好吧,你什么支持?”
  • Response 2: "I support Windows Authentication" [HTTP Status Code 401] 响应2:“我支持Windows身份验证”[HTTP状态代码401]
  • Request 3: "Alright - here's my Windows token" 请求3:“好吧 - 这是我的Windows令牌”
  • Response 3: "Hi RB, here's your web-page" [HTTP Status Code 200] 回复3:“嗨RB,这是你的网页”[HTTP状态代码200]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM