15

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.

Anders Arpi
  • 8,277
  • 3
  • 33
  • 49
  • 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 Jan 04 '12 at 08:17
  • 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 Jan 04 '12 at 08:24
  • have you configured extensionless urls in IIS 6.0? – Darin Dimitrov Jan 04 '12 at 08:32
  • 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 Jan 04 '12 at 08:38

8 Answers8

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

That's all!

Afshin Mehrabani
  • 33,262
  • 29
  • 136
  • 201
6

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.

kingPuppy
  • 2,937
  • 1
  • 18
  • 18
3

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.

Siddhant
  • 1,074
  • 12
  • 22
2

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

Alexander Beletsky
  • 19,453
  • 9
  • 63
  • 86
  • Will check this out, but do note that the application was running without a problem yesterday, and that it hasn't been changed since. – Anders Arpi Jan 04 '12 at 10:08
1

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.

user1216363
  • 11
  • 2
  • 2
  • Thank you, this led me to the solution to an issue I was experiencing where the controller was named the same as a subdirectory residing under the root directory of the website. – Kevin Aug 02 '21 at 17:41
0

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

Shyam Kumar
  • 96
  • 1
  • 3
0

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.

CodeZen
  • 1
  • 1
0

Run this command for install mvc application

install-windowsfeature web-asp-net45

or install ASP.Net 4 in role server Detail

ashkufaraz
  • 5,179
  • 6
  • 51
  • 82