使用IIS 7中的ASP.NET MVC 1来路由具有特定控制器名称的问题

时间:2022-10-27 21:47:07

I have joined a team developing an ASP.NET MVC version 1 application. I run this app on my local machine using IIS version 7.5. My operating system is Windows Server 2008 R2 Enterprise Edition. I use Visual Studio 2008 SP1 for development.

我加入了一个开发ASP.NET MVC版本1应用程序的团队。我使用IIS 7.5版在我的本地计算机上运行此应用程序。我的操作系统是Windows Server 2008 R2 Enterprise Edition。我使用Visual Studio 2008 SP1进行开发。

One of the controllers in this app is called ReportsController. The route table entries for this controller use 'Reports' as the controller name part. The problem I have is that, using IIS 7.5 on my local machine, I simply cannot access any of the Reports action methods. If I try to access, say, '/Reports/Index' from Chrome or Firefox, I get a 401 Unauthorized response (as seen using Fiddler) and the browser displays its username/password entry dialog.

此应用程序中的一个控制器称为ReportsController。此控制器的路由表条目使用“Reports”作为控制器名称部分。我遇到的问题是,在我的本地机器上使用IIS 7.5,我根本无法访问任何Reports操作方法。如果我尝试从Chrome或Firefox访问“/ Reports / Index”,我会收到401 Unauthorized响应(使用Fiddler看到),浏览器会显示其用户名/密码输入对话框。

Please note the following:

请注意以下事项:

  • All other non-Report pages in the application work correctly.
  • 应用程序中的所有其他非报告页面都能正常工作。
  • If I add a breakpoint to Application_BeginRequest, it is not hit when requesting a Reports page.
  • 如果我向Application_BeginRequest添加断点,则在请求“报告”页面时不会触发该断点。
  • If I change the Reports routing entries in the route table registration code so that I have to access paths like '/Reportss/Index' (note the extra 's') then these Reports pages work correctly.
  • 如果我更改路由表注册码中的Reports路由条目,以便我必须访问'/ Reportss / Index'之类的路径(注意额外的's'),那么这些Reports页面可以正常工作。
  • I have tried deleting then recreating my Web application in IIS.
  • 我尝试删除然后在IIS中重新创建我的Web应用程序。
  • The Reports pages work fine if I run the application using the Visual Studio 2008 development server (Cassini).
  • 如果我使用Visual Studio 2008开发服务器(Cassini)运行应用程序,则Reports页面可以正常工作。
  • There is no directory called Reports in the application directory.
  • 应用程序目录中没有名为Reports的目录。
  • The Reports pages work correctly on our UAT environment, also under IIS 7.5.
  • 报告页面在我们的UAT环境中也能正常工作,也在IIS 7.5下。
  • I have reviewed my IIS setting several times, including comparing them with those on UAT, and I can't see a problem.
  • 我已多次查看我的IIS设置,包括将它们与UAT上的设置进行比较,我看不出有问题。

While I can use Cassini to access the Reports pages, I would really like to understand what is causing this issue.

虽然我可以使用Cassini访问Reports页面,但我真的很想了解导致此问题的原因。

3 个解决方案

#1


12  

If you have Reporting Services installed on your machine. try to create a new web site and use it. If you have SSRS installed on your machine it uses /reports for hosting reports.

如果您的计算机上安装了Reporting Services。尝试创建一个新的网站并使用它。如果您的计算机上安装了SSRS,则会使用/ reports来托管报告。

#2


1  

I have had problems using the directory name 'Reports' at the root of a .net 2.0 website on IIS 7.5. It generates a 503 Error, indicating that there is an error at the system level before IIS tries to serve the page. I am not sure if reporting services is installed on my server. I just changed the directory name, all links and everything worked.

我在IIS 7.5上的.net 2.0网站的根目录下使用目录名称“Reports”时遇到问题。它会生成503错误,表示在IIS尝试为页面提供服务之前系统级别存在错误。我不确定我的服务器上是否安装了报告服务。我只是更改了目录名称,所有链接和一切都有效。

#3


1  

I have the exact same issue in my MVC Application with reporting services installed on the same server where code was deployed. I have changed the Reporting Manager URL in "SQL Server Reporting Services Configuration" which was hostName/Reports and assigned a new name i.e. SSRSReports so the virtual directory is now hostName/SSRSReports.

我的MVC应用程序中存在完全相同的问题,并且在部署代码的同一服务器上安装了报告服务。我更改了“SQL Server Reporting Services配置”中的报告管理器URL,该URL是hostName / Reports并分配了一个新名称,即SSRSReports,因此虚拟目录现在是hostName / SSRSReports。

Now my application as well as SSRS Reports are working as expected.

现在我的应用程序以及SSRS报告正在按预期工作。

#1


12  

If you have Reporting Services installed on your machine. try to create a new web site and use it. If you have SSRS installed on your machine it uses /reports for hosting reports.

如果您的计算机上安装了Reporting Services。尝试创建一个新的网站并使用它。如果您的计算机上安装了SSRS,则会使用/ reports来托管报告。

#2


1  

I have had problems using the directory name 'Reports' at the root of a .net 2.0 website on IIS 7.5. It generates a 503 Error, indicating that there is an error at the system level before IIS tries to serve the page. I am not sure if reporting services is installed on my server. I just changed the directory name, all links and everything worked.

我在IIS 7.5上的.net 2.0网站的根目录下使用目录名称“Reports”时遇到问题。它会生成503错误,表示在IIS尝试为页面提供服务之前系统级别存在错误。我不确定我的服务器上是否安装了报告服务。我只是更改了目录名称,所有链接和一切都有效。

#3


1  

I have the exact same issue in my MVC Application with reporting services installed on the same server where code was deployed. I have changed the Reporting Manager URL in "SQL Server Reporting Services Configuration" which was hostName/Reports and assigned a new name i.e. SSRSReports so the virtual directory is now hostName/SSRSReports.

我的MVC应用程序中存在完全相同的问题,并且在部署代码的同一服务器上安装了报告服务。我更改了“SQL Server Reporting Services配置”中的报告管理器URL,该URL是hostName / Reports并分配了一个新名称,即SSRSReports,因此虚拟目录现在是hostName / SSRSReports。

Now my application as well as SSRS Reports are working as expected.

现在我的应用程序以及SSRS报告正在按预期工作。