Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS 6.0 suddenly shows directory listing instead of MVC 3 app

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.

like image 973
Anders Arpi Avatar asked Jan 04 '12 08:01

Anders Arpi


People also ask

Why am I getting a directory listing instead of my site?

If you are expecting to see an existing site however, and instead you see the directory listing something has gone wrong somewhere. The file may have been infected via a php injection attack and removed by a malware scanner. The site may have been attacked. Your account password may not be very secure.

What is directory listing in IIS?

Description. Directory browsing allows the contents of a directory to be displayed upon request from a web client. If directory browsing is enabled for a directory in IIS, users could receive a web page listing the contents of the directory.


2 Answers

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

That's all!

like image 175
Afshin Mehrabani Avatar answered Sep 18 '22 15:09

Afshin Mehrabani


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.

like image 40
kingPuppy Avatar answered Sep 17 '22 15:09

kingPuppy