Tags: Exceptions

«No parameterless constructor defined for this object» after upgrade to Episerver CMS 11

After upgrading a site from CMS 10 to CMS 11 I was faced by this exception:

Server Error: No parameterless constructor defined for this object.

Edit and admin mode works, but every page returns this YSOD (yellow screen of death) exception page.

In the middle of the list of breaking changes for CMS 11 there is a clue:

It is no longer supported to get an ILogger instance from IOC container.

In every page controller, I had:

private readonly ILogger _log;

public DefaultPageController(ILogger logger)
   _log = logger;

Replacing this with:

private readonly ILogger _log = LogManager.GetLogger();

public DefaultPageController()

…resolves the issue.