MVC3 with Razor throws Method not found: 'System.Object System.Web.Mvc.ControllerBase.get_ViewModel()'
Fresh IIS7.5 installation on Win Server 2008 R2.
Installed MVC3 etc. via Web Platform Installer.
Made a basic MVC3 application locally. Just "new project" without anything to it. Made an application on the IIS to host the application. AppPool set to .Net4.
When I run the application locally I get this:
Blockquote
Method not found: 'System.Object System.Web.Mvc.ControllerBase.get_ViewModel()'. 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.MissingMethodException: Method not found: 'System.Object System.Web.Mvc.ControllerBase.get_ViewModel()'.
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:
[MissingMethodException: Method not found: 'System.Object System.Web.Mvc.ControllerBase.get_ViewModel()'.] MinTest.Controllers.HomeController.Index() in C:\Projects\MinTest\MinTest\Controllers\HomeController.cs:17 lambda_method(Closure , ControllerBase , Object[] ) +79
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +264 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary
2 parameters) +39 System.Web.Mvc.<>c_DisplayClass15.b_12() +129 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func1 continuation) +784922 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList
1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +314 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +784976 System.Web.Mvc.Controller.ExecuteCore() +159 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335 System.Web.Mvc.<>c_DisplayClassb.b_5() +62 System.Web.Mvc.Async.<>c_DisplayClass1.b_0() +20 System.Web.Mvc.<>c_DisplayClasse.b_d() +54 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute开发者_开发百科() +453 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +371
I'm lost!
t.
I don't think you are actually loading MVC 3 in IIS. Sounds like you're getting MVC 2 instead. Double-check your MVC 3 installation on the server. Also examine the bindingRedirect
in Web.Config.
精彩评论