Search code examples
.netepiserver

EpiServer System.ArgumentException after installing a working site


I am currently installing an episerver site that I know works, however when after I have installed it I get an exception when trying to login to the site.

2013-10-04 09:19:22,771 ERROR [8] EPiServer.Global.Global_Error - 1.2.5 Unhandled exception in ASP.NET System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ArgumentException: GpnRapport.Presenters.PageHeaderPresenter is missing an expected constructor, or the constructor is not accessible. We tried to execute code equivalent to: new GpnRapport.Presenters.PageHeaderPresenter(ASP.templates_units_pageheader_ascx view). Add a public constructor with a compatible signature, or set PresenterBinder.Factory to an implementation that can supply constructor dependencies.

I cannot see any reason to edit the code, seeing that it works for other people. All I can think of is that this must be en error with episerver config. Any ideas?


Solution

  • It looks like you are using the WebForms MVP framework, and as the stack trace suggests, when trying to create an instance of PageHeaderPresenter, the presenter factory cannot find a suitable constructor to create one.

    If your using the DefaultPresenterFactory, your presenter needs to have a constructor that accepts a single parameter of a type that implements IView, so you need to make sure your pageheader.ascx code behind class implements IView or that it's derived from a type that implements IView.