简体   繁体   English

ASP.NET Windows身份验证-无法显示页面

[英]ASP.NET Windows Authentication - Page cannot be displayed

I have created a simple WebForm asp.net web site. 我创建了一个简单的WebForm asp.net网站。 I have disabled the Windows Authentication checks within the code but set IIS8 to "Windows Authentication" as well as the web.config. 我已禁用代码中的Windows身份验证检查,但将IIS8设置为“ Windows身份验证”以及web.config。 I perform the Indentity.IsAuthenticated check in the backend to ensure the user is authenticated. 我在后端执行Indentity.IsAuthenticated检查,以确保对用户进行身份验证。

My issue is I get "The page cannot be displayed, please check your URL is correct". 我的问题是得到“该页面无法显示,请检查您的URL是否正确”。 (This is in IE) (这是在IE中)

If I set my authentication to Anonymous the site works fine. 如果我将身份验证设置为“匿名”,则该站点可以正常运行。 I disable Anonymous Authentication and enable Windows Authentication only and receive this error. 我禁用匿名身份验证,仅启用Windows身份验证,并收到此错误。 I have done quite abit of reading now and think I am just missing something small. 我现在已经做了大量的阅读工作,并认为我只是缺少一些小东西。 I used the IIS "default site" and set it to Windows Authentication and got a login prompt (as expected). 我使用IIS“默认站点”并将其设置为Windows身份验证,并得到了登录提示(如预期的那样)。

The server is running IIS8, windows 2012. Windows Authentication is installed as a feature, IIS site settings is set to use Windows Authentication only, as is the web.config. 服务器正在运行IIS8,Windows2012。Windows身份验证是一项功能,IIS站点设置设置为仅使用Windows身份验证,web.config也是如此。 The web.config doesn't have Authorization tags for deny and allow but has <authentication mode="Windows" /> . web.config没有用于拒绝和允许的授权标签,但具有<authentication mode="Windows" /> The errors occur on both IE and FireFox. 在IE和FireFox上均会发生错误。 No windows events are logged so i assume it's purely a authentication error that isn't displaying the site. 没有记录Windows事件,因此我认为这纯粹是一个身份验证错误,没有显示该站点。 The AppPool is set to Identity . AppPool设置为Identity

I think what confuses me most is the "default site" (with no code or logic) works and my site doesn't. 我认为最让我困惑的是“默认站点”(没有代码或逻辑)有效,而我的站点无效。 The default site also doesn't have a web.config. 默认站点也没有web.config。

Any ideas would be grateful. 任何想法将不胜感激。

The issue may have to do with Kereberos. 这个问题可能与Kereberos有关。

I had the same issue and whilst troubleshooting server side issues, my co worker indicated that he was able to access the site. 我遇到了同样的问题,并且在对服务器端问题进行故障排除时,我的同事表示他能够访问该站点。

It was then I realized my issue was a client side issue. 那时我意识到我的问题是客户端问题。 Something may have been wrong with my Kerberos tickets. 我的Kerberos票证可能有问题。 Maybe the domain controller that initially issued the ticket to me went offline. 最初向我发行票证的域控制器可能已脱机。 Rebooting my workstation was what got windows authentication working for me again. 重新启动工作站是使Windows身份验证再次为我工作的原因。

Some other things you can try are: Try changing your windows authentication provider to NTLM as a test. 您可以尝试的其他一些方法是:尝试将Windows身份验证提供程序更改为NTLM作为测试。
Click on the site -> Click Authentication -> Click Windows Authentication -> Click Providers Move NTLM to the top or add it if it isn't there. 单击站点->单击身份验证->单击Windows身份验证->单击提供程序将NTLM移至顶部,如果不存在,则将其添加。 Click ok. 单击确定。 IISReset. IIS重置。 And try again. 然后再试一次。

If you prefer to use Kerberos, you may have to set the service principal names using the setspn.exe command. 如果您更喜欢使用Kerberos,则可能必须使用setspn.exe命令设置服务主体名称。

For more information on Kerberos https://blogs.msdn.microsoft.com/chiranth/2014/04/17/setting-up-kerberos-authentication-for-a-website-in-iis/ 有关Kerberos的更多信息https://blogs.msdn.microsoft.com/chiranth/2014/04/17/setting-up-kerberos-authentication-for-a-website-in-iis/

Other things to check: - Check your authorization rules and .NET Authorization Rules to ensure All Users are allowed to access the site. 其他要检查的内容:-检查您的授权规则和.NET授权规则,以确保允许所有用户访问该站点。

  • Look in your IIS logs located at C:\\inetpub\\logs for more clues. 在位于C:\\ inetpub \\ logs的IIS日志中查找更多线索。 In the folder, you'll find a folder for each site named after the site's id. 在该文件夹中,您将找到一个以站点ID命名的每个站点的文件夹。 You can find the site id clicking Sites on the IIS Management console. 您可以在IIS管理控制台上单击“站点”来找到站点ID。 The site ids of each site will be displayed there. 每个站点的站点ID将显示在此处。

  • Verify the application pool identity of the site has enough permissions. 验证站点的应用程序池标识是否具有足够的权限。

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

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