我使用Visual Studio 2015创建了一个MVC Web应用程序.我的目标是根据需要将身份验证模式从none更改为Windows身份验证,以便我可以使用@ User.Identity.Name方法来识别用户.到目前为止我尝试过的简短摘要:
<authentication mode="Windows"/>的内<system.web>标签添加system.webServer标记(每当我添加它时,它都会在ERR_TOO_MANY_REDIRECTS中结束):
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxUrl="10999" maxQueryString="2097151" />
</requestFiltering>
</security>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)我尝试从头开始创建一个新项目,并在项目设置期间整齐地选择Windows身份验证.这工作正常,所以我相信我的IISExpress设置是100%正确.我甚至检查了applicationhost.config文件,它没有我的特定项目的条目.再次,如果我在创建新项目时选择正确的身份验证,它的工作正常.
当我尝试运行Visual Studio项目时,上述所有内容似乎都不起作用并且最终都出现IIS错误:
HTTP Error 404.15 - Not Found
The request filtering module is configured to deny a request where the query string is too long.
Run Code Online (Sandbox Code Playgroud)
这是IIS错误页面中的URL: