Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Routing problem with particular controller name using ASP.NET MVC 1 in IIS 7

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.

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.

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.
  • 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.
  • I have tried deleting then recreating my Web application in IIS.
  • The Reports pages work fine if I run the application using the Visual Studio 2008 development server (Cassini).
  • There is no directory called Reports in the application directory.
  • The Reports pages work correctly on our UAT environment, also under 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.

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

like image 625
stevejay Avatar asked Feb 05 '11 01:02

stevejay


People also ask

How can use routing in ASP.NET MVC?

Routing in ASP.NET MVC cs file in App_Start Folder, You can define Routes in that file, By default route is: Home controller - Index Method. routes. MapRoute has attributes like name, url and defaults like controller name, action and id (optional).

Which of the following is default route pattern in MVC?

The Default route maps the first segment of a URL to a controller name, the second segment of a URL to a controller action, and the third segment to a parameter named id. The Default route maps this URL to the following parameters: controller = Home. action = Index.


3 Answers

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.

like image 112
cengiz han Avatar answered Oct 19 '22 19:10

cengiz han


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.

like image 29
Ty Petrice Avatar answered Oct 19 '22 20:10

Ty Petrice


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.

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

like image 33
Kumar Lachhani Avatar answered Oct 19 '22 21:10

Kumar Lachhani