2011-01-26 35 views
2

Win Server 2008 R2上新安裝的IIS7.5。MVC3 with Razor throws方法未找到:'System.Object System.Web.Mvc.ControllerBase.get_ViewModel()'

通過Web平臺安裝程序安裝了MVC3等。

本地製作了一個基本的MVC3應用程序。只是「新項目」沒有任何東西。 在IIS上創建應用程序以承載應用程序。 AppPool設置爲.Net4。

當我在本地運行應用程序,我得到這樣的:

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, IDictionary 2 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, Func 1 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

我迷路了!

t。

回答

1

我不認爲你實際上在IIS中加載MVC 3。聽起來像你正在獲得MVC 2。仔細檢查服務器上的MVC 3安裝。還要檢查Web.Config中的bindingRedirect

+1

你是對的!排序..生產環境是MVC3,但我的開發機器是在MVC3 RC .. :) – Thomas 2011-01-27 14:51:29

相關問題