新的 Asp.Net MVC5 项目产生一个无限循环登录页面 [英] New Asp.Net MVC5 project produces an infinite loop to login page

查看:22
本文介绍了新的 Asp.Net MVC5 项目产生一个无限循环登录页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用Visual Studio 2013创建一个全新的项目,我选择Asp.Net MVC和框架4.5.1 项目创建完毕,然后,我除了F5启动默认网页之外什么都不做.不幸的是,它会重定向到登录页面,该页面也重定向到登录页面.这是我在浏览器中的网址的简短版本:

I am creating a brand new projet with Visual Studio 2013, I choose Asp.Net MVC and the framework 4.5.1 The project is created, then, I do nothing else than F5 to start the default web page. Unfortunately, it produces a redirect to the login page which is redirecting into the login page too. Here is a short version of the url I have in the browser:

<代码>的http://本地主机:5285/帐户/登录RETURNURL =%2FAccount%2FLogin%3FReturnUrl%3D%252FAccount%252FLogin%253FReturnUrl%253D%25252FAccount%25252FLogin%25253FReturnUrl%25253D%2525252FAccount%2525252FLogin%2525253FReturnUrl%2525253D%252525252FAccount%252525252FLogin%252525253FReturnUrl%252525253D%25252525252FAccount%25252525252FLogin%25252525253FReturnUrl%25252525253D%2525252525252FAccount%2525252525252FLogin%2525252525253FReturnUrl%2525252525253D%252525252525

我在事件查看器中没有任何错误.但在屏幕上我看到:

I do not have any error in the Event Viewer. But in the screen I see :

"HTTP 错误 404.15 - 未找到请求过滤模块是配置为拒绝查询字符串过长的请求."

"HTTP Error 404.15 - Not Found The request filtering module is configured to deny a request where the query string is too long."

网站以 IIS Express 中的默认设置运行.我该如何解决这个问题?我猜我的 Visual Studio 2013 有问题?

The website is running with the default setting in IIS Express. How can I fix this problem? I am guessing something is wrong with my Visual Studio 2013?

如果我创建一个全新的网站并将其托管在 IIS 中,它会起作用.但是,如果我创建一个新网站(不修改任何内容)并点击播放(默认情况下启动 IIS Express),则不会.

It works if I create a brand new website and I host it in IIS. But if I create a new website (without modifying anything) and just hit play (which start IIS Express by default), it doesn't.

我已经删除了 DocumentsIISExpressconfigapplicationhost.config 中的每个网站.我重新编译了所有内容,并创建了此条目:

I have deleted every websites in the DocumentsIISExpressconfigapplicationhost.config. I have recompiled everything, and it created this entry :

    <siteDefaults>
        <logFile logFormat="W3C" directory="%IIS_USER_HOME%Logs" />
        <traceFailedRequestsLogging directory="%IIS_USER_HOME%TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" />
    </siteDefaults>
    <applicationDefaults applicationPool="Clr4IntegratedAppPool" />
    <virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>

我仍然在使用 IIS Express 时遇到错误,而不是使用 IIS.

I am still getting the error with IIS Express, not with IIS.

推荐答案

请注意,这是潜在有害的建议,直接修改 applicationhost 配置文件很少是一个好主意,通常有工具可以做到这对您来说是安全的(例如,从 Visual Studio 中).在继续之前,请务必创建此文件的备份副本,以防您的 IIS Express 成为垃圾.

为了解决这个问题,我使用了位于此处的默认 IIS 配置文件:

To fix this problem, I took the default IIS configuration file located here :

C:WindowsSystem32inetsrvconfigapplicationHost.config

到我的文档

%userprofile%documentsiisexpressconfigapplicationhost.config

它奏效了.

这是因为我设置了一些 Windows 身份验证而不是匿名帐户.

This was because I had some Windows Authentification set and not the anonymous account.

这篇关于新的 Asp.Net MVC5 项目产生一个无限循环登录页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆