1

I have an MVC4 website running fine on dev. When trying to publish to production routing doesn't work. The only rule I have is the default:

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "General", action = "Index", id = UrlParameter.Optional }
        );

However, on production server (IIS7.5 - just like dev) any of the following fails on 404:

<domain>/Home
<domain>/Home/Index

Plain <domain>/ fails on 403.

NOTE: All this while using route debugger

Playing around I stumbled upon the following curiosity:

<domain>/Home/Index.cshtml/3

Actually brought me to the route debugging page, claiming to match on

controller  Home
action      Index.cshtml 
id          61 

More playing showed that it doesn't matter where the ".cshtml" is, it works as long as it's there. e.g. <domain>/.cshtml/Index/4 matched

controller  .cshtml 
action      Index 
id          4

Why would it require a ".cshtml" string, and what can I do about it?

JNF
  • 3,696
  • 3
  • 31
  • 64
  • Maybe its not compatible with MVC4, I've seen some comments on [routing debugger page](http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx) to make work with MVC 3. – developer10214 Nov 06 '13 at 08:52
  • The problem is the routing itself, not the debugger. It's just that even when the debugger is supposed to "catch all" it doesn't. When debugger is not activated same thing happens, just what the debugger would have caught returns a .net error (404, as opposed to the IIS 404) – JNF Nov 06 '13 at 09:29
  • At last, found answer here: http://stackoverflow.com/questions/17717782/deploying-asp-net-mvc-4-app-on-iis-7 – JNF Nov 07 '13 at 06:21

0 Answers0