【问题标题】:Too many redirects error (ASP.NET MVC)重定向错误过多 (ASP.NET MVC)
【发布时间】:2017-09-26 19:15:04
【问题描述】:

我有 MVC 应用程序,我尝试访问移动区域。

所以我决定使用集成到chrome的移动模式。

我的启动控制器是Account/Login

这里是ApplicationStart的代码

 protected void Application_Start()
        {
#if DEBUG
            XmlConfigurator.ConfigureAndWatch(new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logging_DEBUG.config")));
#else
            if (AppDomain.CurrentDomain.BaseDirectory.Contains("DevTrackerweb")
               || AppDomain.CurrentDomain.BaseDirectory.Contains("Trackerweb4Test"))
            {
                XmlConfigurator.ConfigureAndWatch(new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logging_DEBUG.config")));
            }
            else
                XmlConfigurator.ConfigureAndWatch(new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logging.config")));
#endif

            var log = LogManager.GetLogger(AppDomain.CurrentDomain.BaseDirectory);
            log.Info("Application start");

            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            ModelBinders.Binders.Add(typeof(decimal), new DecimalModelBinder());
            ModelBinders.Binders.Add(typeof(decimal?), new NullableDecimalModelBinder());

            Translator.Prefetch().Wait();

            HttpContext.Current.Application.Add("TrackerwebServiceStatus", TrackerwebServiceStatus.OK);

            sitesByHostName = InitializeSites();
            mainCustomerIDByCustomerID = InitializeCustomerIDDictionary();
        }

当我运行它时,我有这个

我该如何解决这个问题?

【问题讨论】:

    标签: asp.net asp.net-mvc asp.net-mvc-4


    【解决方案1】:

    我的猜测是您的登录页面/操作未配置为匿名访问。尝试将 AllowAnonymous 属性添加到 Login 操作方法。

    【讨论】:

    【解决方案2】:

    所以问题在于它是遗留代码,我有 MvcSiteMap 扩展,我删除了。

    在网络配置中,我有一些与此扩展相关的代码,当我删除它时,一切正常

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-06-14
      • 1970-01-01
      • 1970-01-01
      • 2014-06-20
      • 2018-05-02
      • 1970-01-01
      • 2012-02-08
      • 2018-12-13
      相关资源
      最近更新 更多