0
這是我懷疑的新手配置問題。嘗試返回模型的MVC 4控制器編譯錯誤
請參閱代碼片段中的return語句註釋。
[HttpGet]
public ActionResult TestService()
{
ViewBag.Message = "DataLayer Service";
Service dataLayerService = new Service {CookieContainer = new CookieContainer()};
dataLayerService.SetSessionAppName("SAND");
WebServiceModel webServiceModel = new WebServiceModel();
webServiceModel.Result = dataLayerService.GetSessionAppName();
return this.View(webServiceModel); // <== Cannot resolve View "TestService"
}
那麼你有一個叫做「TestService」的視圖嗎?它將在Views /(ControllerName)/ – Brandon
好的,解決了我的問題。我需要創建一個強類型的視圖。 http://www.asp.net/mvc/tutorials/views/dynamic-v-strongly-typed-views – Joe