Problem to Host in IIS

Vote:
 

Hi ,

After hosting my EPi site in IIS , while browsing the same , I am getting the following error after login(using windows authentication)

Server Error in '/' Application.

Content with id '183' is of type 'Castle.Proxies.ArticlePageProxy' which does not inherit required type 'EPIServerExtranet.Models.Pages.StartPage'

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: EPiServer.Core.TypeMismatchException: Content with id '183' is of type 'Castle.Proxies.ArticlePageProxy' which does not inherit required type 'EPIServerExtranet.Models.Pages.StartPage'

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[TypeMismatchException: Content with id '183' is of type 'Castle.Proxies.ArticlePageProxy' which does not inherit required type 'EPIServerExtranet.Models.Pages.StartPage']
   EPiServer.Core.DefaultContentLoader.ThrowTypeMismatchException(ContentReference link, Type actual, Type required) +171
   EPiServer.Core.DefaultContentLoader.Get(ContentReference contentLink, LoaderOptions loaderOptions) +373
   EPIServerExtranet.Business.PageViewContextFactory.CreateLayoutModel(ContentReference currentContentLink, RequestContext requestContext) +107
   EPIServerExtranet.Business.PageContextActionFilter.OnResultExecuting(ResultExecutingContext filterContext) +210
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +236
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +833
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +81

Please let me know what I need to do here.

Thanks in advance.

#150177
Jun 13, 2016 12:30
Vote:
 

Sounds like you have a bad casting to StartPage somewhere in the 

EPIServerExtranet.Business.PageViewContextFactory.CreateLayoutModel

So check that method and see if it tries to cast the current page to a startpage. Looks like you have a call like

contentRepository.Get<StartPage>(currentContentLink)

or similar which will crash and burn because currentContentLink points to an article page.
Instead do something like:
var currentPage = contentRepository.Get<IContent>(currentContentLink);
var startPage = currentPage as StartPage;
if(startPage!=null)
{
//Create layout if you are on start page....
}


#150188
Jun 13, 2016 15:46
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.