Asp – Could not load type ‘System.Web.Mvc.AreaRegistration’

asp.net-mvc

[TypeLoadException: Could not load type
'System.Web.Mvc.AreaRegistration' from assembly 'System.Web.Mvc,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
HemelMvc.MvcApplication.Application_Start() in
D:\@Hemel\HemelMvc\src\HemelMvc\Global.asax.cs:72

[HttpException (0x80004005): Could not load type
'System.Web.Mvc.AreaRegistration' from assembly 'System.Web.Mvc,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext
context, HttpApplication app) +2723002
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr
appContext, HttpContext context, MethodInfo[] handlers) +128
System.Web.HttpApplication.InitSpecial(HttpApplicationState state,
MethodInfo[] handlers, IntPtr appContext, HttpContext context) +188
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr
appContext, HttpContext context) +295
System.Web.HttpApplicationFactory.GetPipelineApplicationInstance(IntPtr
appContext, HttpContext context) +56
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr
appContext) +231

[HttpException (0x80004005): Could not load type
'System.Web.Mvc.AreaRegistration' from assembly 'System.Web.Mvc,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8896063
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +85
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
wr, HttpContext context) +333


Got this error when copied ASP.NET MVC 2 RC application to shared hosting.

    protected void Application_Start()
    {
        AreaRegistration.RegisterAllAreas();

        RegisterRoutes(RouteTable.Routes);
    }

Line 72 in Global.asax.cs is after >> RegisterRoutes(RouteTable.Routes);

Why is there reference to my local path on remote site??
D:\@Hemel\HemelMvc\src\HemelMvc\Global.asax.cs:72

Best Answer

Local path info is stored in the PDB file which helps the VS debugger help you. You don't need to include it on your host and you should switch your project configuration to "Release" so it does not include all the extra debugging info.

BTW you're probably getting the "could not load type" error because the shared host doesn't have MVC2 installed.

Related Topic