I have an mvc app developed and tested with Cassini. Deployed to my site on GoDaddy, and the default page comes up fine. Click to log in, and I get a 404.
I’m running under IIS 7 there, so this is unexpected. My routes are pretty plain:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Public", action = "Index", id = "" }
);
routes.MapRoute(
"Report1",
"Report/{action}/{start}/{end}",
new { controller = "Report", action = "Index" }
);
routes.MapRoute(
"Report2",
"Report/{action}/{start}/{end}/{idList}",
new { controller = "Report", action = "Index" }
);
Any idea what might be going on or how I can troubleshoot this?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Are you running in IIS7 integrated mode?
Classic mode of IIS7 does not automatically map extensionless URLs to ASP.NET (much like IIS6).
Also make sure your Web.config <system.webServer> tag is configured correctly.
Method 2
Don’t use runAllManagedModulesForAllRequests. You want to let IIS handle resources such as images.
<system.webServer> <!-- Rather do NOT use this --> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer>
Instead add the MVC routing module
<system.webServer>
<modules>
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
</modules>
</system.webServer>
Method 3
Tried everything, I had to set my web config like this, to make it work.
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
Method 4
I had the same problem, I uploaded the controller, web.config and other classes but I forgot to upload the bin folder.
After I uploaded the bin folder, it worked!
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0