Aug 16, 2012

Asp.Net Mvc App showing Directory Listing after deployment..

Task: To set up a fresh web environment.
Specs for the web site: Asp.net MVC 3 + EF 4.1 + MS Sync framework 2.1
Specs for the site: Windows 2008 R2 + IIS 7.5
Steps:
1. Installed the Prerequisites (IIS + ASP.Net MVC 3 + EF + MS Sync Framework + Sql Server express etc..)
2. Copied the bits from a working server and dropped to the appropriate folder.
3. Created a Virtual Directory, inside the IIS, targeting the folder.
4. Set up the app pool.
5. Launched the site..

After initial hiccups like setting up the DB account for the app pool.. and some other smaler ones regarding the web.config, I was stuck at the following...
The website was continuously displaying the directory listing for the site and not the site itself..

Cause:
IIS is not using the ASP.Net Mvc dlls to render the site and instead is looking for a default webpage.

Solution:
  1. Open Command prompt
  2. Go to C:\Windows\Microsoft.NET\Framework\ folder.
  3. Run aspnet_regiis -ir