Could not load type System.Web.Mvc.IDependencyResolver

Jan 19, 2011 at 2:17 PM

I just created my first Orchard site after installing it via the Web PI and get the following error when I try to run it. Googling for the cause didn't yield much so I thought I'd ask here if anyone else has seen this and can point out my (probably obvious) mistake !

Could not load type 'System.Web.Mvc.IDependencyResolver' from assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.TypeLoadException: Could not load type 'System.Web.Mvc.IDependencyResolver' from assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[TypeLoadException: Could not load type 'System.Web.Mvc.IDependencyResolver' from assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
   Orchard.Environment.OrchardStarter.CreateHostContainer(Action`1 registrations) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Environment\OrchardStarter.cs:135
   Orchard.Web.MvcApplication.Application_Start() in d:\TeamCity\Projects\Orchard-1.x\src\Orchard.Web\Global.asax.cs:21

[HttpException (0x80004005): Could not load type 'System.Web.Mvc.IDependencyResolver' from assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9029049
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +131
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +194
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +339
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +253

[HttpException (0x80004005): Could not load type 'System.Web.Mvc.IDependencyResolver' from assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8950740
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256

Jan 19, 2011 at 2:19 PM

I should add that I am running it from WebMatrix (so it is using http://localhost:14450/) and this is 64-bit Windows 7......

Coordinator
Jan 19, 2011 at 4:54 PM

You probably have a pre-release version of MVC 3 on that machine. Try to uninstall that.

Jan 20, 2011 at 7:44 AM

I thought it was the final version of MVC 3 (and Add/Remove Programs suggested the same) but a re-install did indeed cure it so there must have been something lurking there from an earlier release after all.

Thank you for your help.