网站要求"需要身份验证和QUOT;一个MVC控制器上,而不是其他 [英] Website asks for "Authentication Required" on an MVC controller, but not others

查看:148
本文介绍了网站要求"需要身份验证和QUOT;一个MVC控制器上,而不是其他的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp.net C#MVC的网站。它采用SimpleAuthentication和窗体身份验证。一切工作正常,要求人们登录到网页。不过,我称之为ReportsController一个控制器。只要你去行动的URL的这个控制器中,它总是以需要身份验证,在浏览器窗口中弹出。



它只是做了该控制器没有任何其他人。该URL将是www.domain.com/reports。当我从IIS和从我的开发服务器运行这个URL工作正常,但不是我的活的服务器上。这是运行IIS7。



我已经检查我的web.config,它肯定是设置为Forms身份验证,而不是Windows操作系统。



任何人有任何想法,为什么用/报告开头的任何URL是行不通的。我猜测它是特定于服务器的东西如IIS设置或改变的web.config,但是我想不通这是什么会。

 命名空间ProjectName.Controllers 
{
公共类ReportsController:控制器
{
公众的ActionResult指数()
{
抛出SystemException的新(这里);

返回查看();
}
}
}



Web.config文件:

 <身份验证模式=表格> 
<形式loginUrl =〜/超时=2880/>
< /认证>


解决方案

所以,事实证明,SQL Server报表服务正在运行在服务器上。这是承担该服务器上所有网站的/报告URL的控制权。



我没有使用SQL Server的报告,让我去Reporting Services配置管理器服务器上除去的IP地址和端口它被侦听。您还可以更改它使用,而不是如果你仍然需要使用这个网址。


I have an asp.net C# MVC website. It uses SimpleAuthentication and forms authentication. Everything works fine, requiring people to log in to go to pages. However, I have one controller called "ReportsController". Whenever you go to the URL's of the actions within this controller it always pops up with "Authentication Required" in the browser window.

It is only doing it for this controller and not any others. The URL will be "www.domain.com/reports". This URL works fine when I run from IIS and from my development server, but not on my live server. This is running IIS7.

I have checked my web.config and it is definately set to Forms authentication and not Windows.

Anyone have any ideas why any urls beginning with "/Reports" would not work. I am guessing it is something specific to the server, such as an IIS setting or web.config change, but I cannot figure out what this would be.

namespace ProjectName.Controllers
{
    public class ReportsController : Controller
    {
        public ActionResult Index()
        {
            throw new SystemException("here");

            return View();
        }
    }
}

Web.config:

<authentication mode="Forms">
  <forms loginUrl="~/" timeout="2880" />
</authentication>

解决方案

So it turns out that Sql Server Reporting Services was running on the server. This was taking control of the "/Reports" URL on all websites on that server.

I am not using SQL Server Reports, so I went to "Reporting Services Configuration Manager" on the server and removed the IP address and port it was listening on. You can also change the URL it uses instead if you still need to use this.

这篇关于网站要求&QUOT;需要身份验证和QUOT;一个MVC控制器上,而不是其他的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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