Receiving 404 error when trying to get to MVC application in local IIS
Posted
by Corey Sunwold
on Stack Overflow
See other posts from Stack Overflow
or by Corey Sunwold
Published on 2010-05-21T21:44:55Z
Indexed on
2010/05/21
21:50 UTC
Read the original article
Hit count: 170
iis7
|asp.net-mvc-routing
I have an existing web site setup on my local IIS built with web forms setup in this format:
-MainSite
-Application1
-Application2
-Application3
There are separate applications in each location, so MainSite has an application, and Application1 has another application and so on. This way development on different applications in the same site can be broken out. I want to add a new Application that is MVC instead of web forms. I created a new MVC project which runs in Cassini just fine, but when I create a new IIS application for it and point it to the MVC project I am unable to navigate to it in the browser and get a 404 error. I am expecting to be able to navigate to http://MainSite/NewMVCApplication/. I want the root of NewMVCApplication to point to my Contacts Controller.
My global.asax in the new MVC application currently looks like this:
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Root", // Route name
"", // URL with parameters
new { controller = "Contacts", action = "Index", id = "" } // Parameter defaults
);
}
protected void Application_Start()
{
RegisterRoutes(RouteTable.Routes);
RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes);
}
}
© Stack Overflow or respective owner