5

Using Sitecore 8.2

I have multiple MVC projects in a VS Solution. For each project, I remove the RouteConfig.cs, but for one, I forgot and clicked on publish. (I'm not sure if thats the reason for the error).

Now the page thows this error -

The controller for path '/en/home' was not found or does not implement IController.

I removed the RouteConfig.cs and published again but no luck. Also, none of the MVC projects have Global.asax included.

I also tried giving the full path in controller rendering.

Controller: Sitecore.Feature.Teasers.Controllers.TeasersController, Sitecore.Feature.Teasers  
Controller Action: RenderTeaser

TeasersController.cs

namespace Sitecore.Feature.Teasers.Controllers
{
    public class TeasersController : SitecoreController
    {
        // GET: Teasers
        public ActionResult RenderTeaser()
        {
            IEnumerable<Item> teasers = GetTeasers();
            return View("~/Views/Teasers/Teasers.cshtml", teasers);
        }        
    }
}

How can I fix this. Thank you.

4
  • Is it the only controller rendering on the page? Are other controller renderings working as expected? From the same assembly are other controller renderings working as expected?
    – phani
    Dec 5, 2016 at 14:10
  • 1
    Try doing a full-text search in your solution to check if MapRoute( is used anywhere. When you find it, remove it, then do a full rebuild of your solution and redeploy it. Dec 6, 2016 at 14:25
  • Try inheriting TeaserController by System.Web.Mvc.Controller instead of SitecoreController Feb 3, 2017 at 12:06
  • Do you only get this error on the page with this controller rendering or any page?
    – Chris Auer
    Feb 3, 2017 at 13:54

3 Answers 3

5

You need to inherit from Controller, not SitecoreController.

SitecoreController is Sitecore's own controller (duh, hehe) used for Sitecore's View Rendering components - but is not the one you are meant to inherit from for your own Controller Rendering components.

See also: How To Make Sitecore Use a MVC Controller, Controller Renderings Explained

1

For other still seeing this issue, here is one more scenario: In my case I was seeing various DLL issues, so I decided to replace bin of my project with an bin of new instance. Then saw this error. Clean and built my project and then published the code from Visual studio. Everything then started working as expected.

0

Looks like the dlls are in the temporary cache. Simply try an IIS recycle or reset. And check.

1
  • That did not work:(
    – sukesh
    Dec 5, 2016 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.