Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Greg 12 posts 102 karma points
    Dec 16, 2019 @ 16:08
    Greg
    0

    Cannot bind source content type Umbraco.Web.PublishedCache.NuCache.PublishedContent to model type Foo.PublishedContentModels.Home.

    I've just deployed my site to Azure, and published my database using SSMS' Deploy Database to Microsoft Azure SQL Database feature. Both completed successfully. I can log into umbraco and see all the content I had locally on the Azure site but when I try to hit the homepage I get a YSOD with the error below. What's happening? What am I missing?

    (Cross posted on stackoverflow.)

    Error:

    Server Error in '/' Application.
    Cannot bind source content type Umbraco.Web.PublishedCache.NuCache.PublishedContent to model type Foo.PublishedContentModels.Home.
    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: Umbraco.Web.Mvc.ModelBindingException: Cannot bind source content type Umbraco.Web.PublishedCache.NuCache.PublishedContent to model type Foo.PublishedContentModels.Home.
    
    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:
    
    
    [ModelBindingException: Cannot bind source content type Umbraco.Web.PublishedCache.NuCache.PublishedContent to model type Foo.PublishedContentModels.Home.]
       Umbraco.Web.Mvc.ContentModelBinder.ThrowModelBindingException(Boolean sourceContent, Boolean modelContent, Type sourceType, Type modelType) in D:\a\1\s\src\Umbraco.Web\Mvc\ContentModelBinder.cs:159
       Umbraco.Web.Mvc.ContentModelBinder.BindModel(Object source, Type modelType) in D:\a\1\s\src\Umbraco.Web\Mvc\ContentModelBinder.cs:94
       Umbraco.Web.Mvc.UmbracoViewPage`1.SetViewData(ViewDataDictionary viewData) in D:\a\1\s\src\Umbraco.Web\Mvc\UmbracoViewPageOfTModel.cs:152
       System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +99
       System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +107
       Umbraco.Web.Mvc.ProfilingView.Render(ViewContext viewContext, TextWriter writer) in D:\a\1\s\src\Umbraco.Web\Mvc\ProfilingView.cs:25
       System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +291
       System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
    
  • Greg 12 posts 102 karma points
    Dec 17, 2019 @ 14:20
    Greg
    100

    Got it,

    What I'd done is disabled modelsBuilder with a config transform going to Azure without realizing this disables the Model Binder as well as Model Builder:

    <add key="Umbraco.ModelsBuilder.Enable" value="false" xdt:Locator="Match(key)" xdt:Transform="SetAttributes" />
    

    What I really wanted to do was leave Umbraco.ModelsBuilder.Enable == true and set Umbraco.ModelsBuilder.ModelsMode == Nothing:

    <add key="Umbraco.ModelsBuilder.ModelsMode" value="Nothing" xdt:Locator="Match(key)" xdt:Transform="SetAttributes" />
    

    This works as expected.

Please Sign in or register to post replies

Write your reply to:

Draft