Exception under Mono

Jul 11, 2012 at 4:16 AM

MapRouteLowercase works well on my local asp server, but when I move it over to my mono server I get this exception. Properly cased routes still work, but the lower case ones give this exception.

The view 'logon' or its master was not found or no view engine supports the searched locations. The following locations were searched: ~/Views/account/logon.aspx~/Views/account/logon.ascx ~/Views/Shared/logon.aspx ~/Views/Shared/logon.ascx ~/Views/account/logon.cshtml ~/Views/account/logon.vbhtml ~/Views/Shared/logon.cshtml~/Views/Shared/logon.vbhtml

   Description: HTTP 500. Error processing request.
   Stack Trace:
System.InvalidOperationException: The view 'logon' or its master was not found or no view engine supports the searched locations. The following locations were searched:~/Views/account/logon.aspx~/Views/account/logon.ascx~/Views/Shared/logon.aspx~/Views/Shared/logon.ascx~/Views/account/logon.cshtml~/Views/account/logon.vbhtml~/Views/Shared/logon.cshtml~/Views/Shared/logon.vbhtml  at System.Web.Mvc.ViewResult.FindView (System.Web.Mvc.ControllerContext context) [0x00000] in <filename unknown>:0  at System.Web.Mvc.ViewResultBase.ExecuteResult (System.Web.Mvc.ControllerContext context) [0x00000] in <filename unknown>:0  at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult (System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionResult actionResult) [0x00000]in <filename unknown>:0  at System.Web.Mvc.ControllerActionInvoker+<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19 () [0x00000] in <filename unknown>:0  at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter (IResultFilter filter, System.Web.Mvc.ResultExecutingContext preContext, System.Func`1 continuation) [0x00000] in <filename unknown>:0     __________________________________________________________________________________________________________________________________________________________
   Version information: Mono Runtime Version: 2.10.5 (Debian 2.10.5-1); ASP.NET Version: 4.0.30319.1

Jul 11, 2012 at 7:04 PM

I am no expert on Mono infrastructure, but I'm pretty sure this is because Mono runs under Apache and by default the Apache file system is case-sensitive.

If the URL is /account/logon, for example, IIS will match it to a view named LogOn.cshtml, logon.cshtml, LOGON.cshtml, or LoGoN.cshtml. However, Apache will not. It wants to see logon.cshtml only.

Again, I don't know that much about running a Mono server, so I don't know if there is any way to disable this case-sensitivity. I suspect there probably is a way to do that. Otherwise, you can rename your view files as all lowercase, i.e. logon.cshtml instead of LogOn.cshtml.

Let me know how you make out.

Jul 11, 2012 at 8:20 PM

Ah that's probably the answer - the linux file system is case sensitive. I'm running Nginx which forwards requests to a FastCGI Mono server. I think the answer to my problems is here - http://www.mono-project.com/IOMap. I just need to figure out how to turn it on. Thanks, I'll let you know if I get it working :)