MVC2 Website hosted on IIS7 shows directory listing not the Home/Index
Here are the things you might check:
- If your application is using ASP.NET 4 ensure that this is registered in IIS. The following command should register it using the
aspnet_regiis.exe
tool:c:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis - ir
(adapt the paths with the proper version of the framework if necessary). - Ensure that the application pool which is configured for the website is using Integrated pipeline mode.
Rajesh Dhiman
Hi, My name is Rajesh Dhiman. I am a full-stack web developer who is passionate about designing and implementing scalable and maintainable web applications/services with the TDD/BDD approach. I can develop complex server-side logic, definition, and maintenance of the central database, ensuring high performance and responsiveness to requests from the front-end. I have always been fascinated by finding out how things work and creating something new. I thrive when I can solve complex problems with elegant solutions using web technologies and even better - learn something on the way. In addition to my technical work, I am also passionate about mentoring people who want to start their carrier in software development. When I'm not coding, you can find me cycling or cooking something in my kitchen.
Updated on July 29, 2022Comments
-
Rajesh Dhiman almost 2 years
I am trying to host a MVC2 website to IIS. Steps I have followed:
- Create a Website in IIS ( define directory defined physical path and app pool)
- Published code from visual studio to the physical path.
But when I tried to browse my site it was giving me error
HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory.
So, I enabled Directory Browsing feature, Now it only shows directory listing. What I have tried?
- Added wildcard script map for aspnet_isapi.dll
- enabled HTTP Redirection and some other things that I have found on some answers related to this question but nothing worked for me.
My routing configurations are
public class MvcApplication : System.Web.HttpApplication { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); } protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes); } }
-
Rajesh Dhiman over 10 yearsApplication pool is integrated and I have tried the above tool but didn't worked for me
-
Darin Dimitrov over 10 yearsIs the application pool configured to run with .NET 4.0? Also have you verified that the application files are deployed to the correct directory to which the website is pointing?
-
Rajesh Dhiman over 10 yearsYes the application pool is configured to .NET 4.0. and the directory to which website is pointing is like "C:\inetpub\wwwroot\myWeb" and this contains my published code.
-
Rajesh Dhiman over 10 yearsI don't know I have been stuck in this issue for quite some days and almost tried every solution found on internet but still not able to make it work
-
Darin Dimitrov over 10 yearsIf you put a simple .aspx page at the root is it served?
-
Darin Dimitrov over 10 yearsIs your MVC2 application configured to serve extensionless routes? How does your routing configuration look like?
-
Rajesh Dhiman over 10 yearsUpdated question with my routing configurations.
-
Darin Dimitrov over 10 yearsWhat if you try to access directly some controller action:
http://example.com/home/index
? -
Rajesh Dhiman over 10 years
-
Rajesh Dhiman over 10 yearsThanks @edtruant, but my framework folder displays folders of all versions of .NET from v1.0.3705 to v4.0.30319. but I will try reinstalling and registering .NET framework.
-
endo64 over 7 years"c:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis -ir" worked for me.