14
votes

Over night an (internal, luckily) MVC web application has stopped working for me, without anything being changed as far as I know. The application itself absolutely hasn't been tinkered with in the last two days and the same goes for IIS.

The problem is that I get a directory listing of my www-folder instead of the applications default action (/Home/Index).

My www-folder contains the standard stuff:

bin
Content
Scripts
Views
Global.asax
Web.config

I have tried:

  • setting a "Specific Page" as Start Action but it doesn't solve the problem.
  • restarting the web page in IIS
  • enable/disabled "default content page" in IIS. Doesn't help, but IIS does pick up on a Default.html if I place it in the www-folder.

Now, this has happened once before. At the time I was on vacation and it was solved by restarting the entire World Wide Web Publishing Service. While it might work this time as well, I'd rather figure out the root of the problem before temporarily fixing it just to have it happen again further down the road. So while a WWW Publishing Service restart might get the site running again I'd rather understand why it happened in the first place before fixing it this way.

Finally, note that I'm running other MVC apps on the same IIS server and have never gotten this problem with them.

7
How can you possible get a directory listing for an url which physically doesn't exist on the server (/Home/Index)? What does it list this directory that you are seeing? Aren't you getting a 404 error?Darin Dimitrov
No 404 or error message whatsoever. It is listing my actual www-folder's content, and isn't trying to access /Home/Index as far as I can tell.Anders Arpi
have you configured extensionless urls in IIS 6.0?Darin Dimitrov
Not explicitly, but I'm assuming it's working since I am running three other MVC apps on the very same IIS server and they have never had a problem (adding this to original question).Anders Arpi

7 Answers

21
votes
  1. Open Command prompt
  2. Go to C:\Windows\Microsoft.NET\Framework\<version> folder.
  3. Run aspnet_regiis -i

That's all!

6
votes

A little late.... But as I was receiving the same result.

My Application Pool was targeting the wrong .Net version (should be same as web app Target Framework). Simply adjusted within the "Set Application Pool Defaults" option, restarted and it was solved.

Hope it helps someone.

3
votes

I had a similar problem. The IIS root path had been changed by a collegue. The solution was to fix the "Physical Path" in the "Advanced Settings" of the Default Web Site.

2
votes

I don't think /Home/Index is possible to run om IIS 6.0 with out any configuration. ASP.NET MVC actually requires "Intergrated Mode", but could be run on classic with applying configuration.

That article by mister Haack, could be helpful: http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx

1
votes

Saw this problem when I added a folder called "documents" at the root and also had a DOCUMENTS controller & view. I think it was confused if I wanted the route \documents which is in the CONTROLLER folder or the \documents folder below the root. One solution was to add an id to the route which makes it use the controller version of documents

Url.Action("Index", "Documents", *New With {.id = 1}*)

Can also change the name of the newly added folder below the root to DOCS.

0
votes

Changing the .NET CLR version of the application pool might help.

  1. Right click on the application pool in which your application is running and select Advanced Settings...
  2. Change the .NET CLR VERSION to the version of your application(same as that in the config files)
  3. Click ok

enter image description here

0
votes

I had the same problem and here is how I resolved it.

I had a problem with the Global.asax file on the TFS server inheriting from the WebAPI project (and not the web project) although the web project was chosen as the startup project in Visual Studio. When I ran my build the Web API was set as the start up project on the web server since it was deploying the version on the TFS server that was inheriting from the WebAPI project. To resolve this I set another project as the startup project and then changed the web project to be the startup project again in Visual studio. I had to do this since TFS complained that there were no pending changes when I tried to check the version I had on my machine into TFS. I then checked my code in and ran the build again. This resolved my issue.