Question

I am attempting to deploy an ASP.NET MVC application in a subdirectory of an existing application and I am running into some routing issues. I have set up the folder structure such that all of the binaries and config files for the MVC app are correctly located in the root directory, while the rest of the content is in the subdirectory. Additionally, I updated all of the routes in the MVC application to reflect the subdirectory; however, every request to the application produces:

The incoming request does not match any route.

All defined routes are being ignored, including the default route:

routes.MapRouteLowercase(
    "Main_Default",
    "blog/{controller}/{action}/{id}",
    new { controller = "Home", action = "Index", id = "" }
);

I tried enabling RouteDebug to test the issue, but even that is not getting routed to. Any advice on what else I can try?

Note: This question is not a duplicate.

Was it helpful?

Solution 2

Looks like I found the problem.

In addition to the binaries and the config files, Global.asax must also be placed in the root in order for its code to be executed.

Thanks guys. :)

OTHER TIPS

Try running it as a virtual directory instead of just a directory, otherwise your routes are not going to be called. You will not need to put the name of the virtual directory in the route.

Here's a route that I have setup in a v-dir MVC app that works just fine...

routes.MapRoute(
    "Default",                                              // Route name
    "{controller}/{action}/{id}",                           // URL with parameters
    new { controller = "Tour", action = "Index", id = "" }  // Parameter defaults
);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top