2015-10-13 27 views
1

我更新了sitecore 7.0到7.5,並且有一些由MVC3創建的控制器渲染項目。MVC中的Sitecore錯誤路線

當我在7.5執行它們,它顯示了一個錯誤:

Could not create controller: 'Components'. The current route url is: 'api/sitecore/{controller}/{action}'. `Message: The controller for path '/api/sitecore/Components/Navigation' was not found or does not implement IController.

控制器的名稱是Components和行動是Navigation

我在Sitecore的7.0完美工作。 我該如何解決這個問題?

+0

你有一個名爲'ComponentsController'的控制器,它是否繼承自Controller? – DavidG

+0

不,我沒有。我通過傳遞'@ Url.Action(「Navigation」,「Components」)使用ajax調用post請求' – Jay

+0

我不知道它是否相關,但Sitecore 7.5不支持MVC3。它需要MVC 5.1(請參閱兼容性表https://kb.sitecore.net/articles/087164)。此外,您可能需要遵循約定並將組件重命名爲「ComponentsController」(同時仍使用「/ api/sitecore/components/navigation」路徑)。 –

回答

1

是,嘗試添加「控制器」到您的「組成部分」,如「componentsController」,你還可以在Sitecore.Speak.Mvc.config文件中/App_Config/Includes/

禁用CommandRoutePrefix另外,如果你想要的值傳遞到特定的位置,你可以使用靜態url而不是@Url.Action(...)