Problems with Mono, MVC, and FastCGI

672 Views Asked by At

I have two websites that I have created with Mono.NET. Both were built exclusively using Xamarin Studio (e.g. MonoDevelop). The first is a standard Asp.NET webforms application and the second is an Asp.NET MVC application.

I have deployed the first application to my RedHat 7 server successfully. The server is running NGINX as the pass through and leverages FastCGI. The web application itself is run at the root (/var/www/html/) and thus pointing to http://[myserver].com/ kicks of the application. This all works beautiful.

My second application (the MVC one) should run as a sort of virtual directory of the root. So pointing to http://[myserver].com/admin/ should access the MVC application. This has been configured correctly on the server and when you point to http://[myserver].com/admin, it clearly attempts to start the MVC application.

My problem is that trying to access http://[myserver].com/admin, throws an application exception:

System.Web.Compilation.ParseException
Cannot find type Letters.Web.Admin.MvcApplication

Description: Error parsing a resource required to service this request. Review your source file and modify it to fix this error.
Details: Cannot find type Letters.Web.Admin.MvcApplication
Error origin: Parser
Error source file: /var/www/html/admin/Global.asax

Error source context:
Error lines: 1, 1
1: <%@ Application CodeBehind="Global.asax.cs" Inherits="Letters.Web.Admin.MvcApplication" Language="C#" %>

I've been googling about this error for 2 days with no luck. I have double checked to make sure the /bin directory exists in the /admin folder (it does) and that all of the appropriate .dll files are present including the web application dll (also present). I have made sure my Global.asax has the appropriate declaration (it does ... see below)

<%@ Application CodeBehind="Global.asax.cs" Inherits="Letters.Web.Admin.MvcApplication" Language="C#" %>

I have also made sure the namespace is correct in the codebehind (it is... see below)

namespace Letters.Web.Admin
{
    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterRoutes (RouteCollection routes)
        {
            routes.IgnoreRoute ("{resource}.axd/{*pathInfo}");

            routes.MapRoute (
                "Default",
                "{controller}/{action}/{id}",
                new { controller = "Home", action = "Index", id = "" }
            );

        }

        public static void RegisterGlobalFilters (GlobalFilterCollection filters)
        {
            filters.Add (new HandleErrorAttribute ());
        }

        protected void Application_Start ()
        {
            AreaRegistration.RegisterAllAreas ();
            RegisterGlobalFilters (GlobalFilters.Filters);
            RegisterRoutes (RouteTable.Routes);
        }
    }
}

I cannot for the life of me figure out the issue. Everything appears to be functioning correctly. This application runs fine on my mac using Xamarin studio. I've double checked and I have the same version of mono installed on my mac as I do on the server. I'm guessing there is probably something else going on that is being obfuscated by this error but for the life of me, I can't figure out the issue. Does anyone have any ideas?

0

There are 0 best solutions below