ASP.NET MVC 5 : Endless redirect to the login page using the site template

时光总嘲笑我的痴心妄想 提交于 2019-11-28 13:34:09

Ok so after a good night's sleep I ended up finding what's wrong: the problem was in the IIS Express configuration, which was not reset for some reason when I created a new project, and probably inherited a previous project's settings. It had Anonymous Authentication disabled and Windows Authentication enabled, which is not compatible with the default web.config created by the template, since it had authentication mode set to None. So IIS was expecting a Windows authentication before any resource is served, and the website did not ask for Windows credentials. And there we have an infinite loop.

TL;DR If you have that same problem, check the project properties (select the project in the solution explorer, and press F4). The Anonymous Authentication entry should be set to Enabled, and the Windows Authentication entry should be set to Disabled. Note that this is only valid if you do not select Windows Authentication in the template settings !

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!