Copied to clipboard

Flag this post as spam?

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


  • Matt 171 posts 445 karma points
    Apr 13, 2019 @ 01:44
    Matt
    0

    Umbraco error on published files

    Hello all,

    So I've been working on a website on my local machine, everything is working perfect.

    However I've now uploaded it to a VPS and published all the files and now I keep getting the following error;

    The model item passed into the dictionary is of type 'Umbraco.Web.Models.RenderModel1[Umbraco.Web.PublishedContentModels.Home]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable1[Cogworks.Meganav.Models.MeganavItem]'. 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: System.InvalidOperationException: The model item passed into the dictionary is of type 'Umbraco.Web.Models.RenderModel1[Umbraco.Web.PublishedContentModels.Home]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable1[Cogworks.Meganav.Models.MeganavItem]'.

    Source Error:

    Line 32: @{ Line 33: var homeNode = Model.Content.Site().OfType

    I'm not sure whats going on as it works fine on my local machine?

    Thanks

  • Matt 171 posts 445 karma points
    Apr 14, 2019 @ 11:47
    Matt
    0

    Anyone got an ideas what I'm missing??

  • Dave Woestenborghs 3193 posts 10608 karma points MVP 4x admin c-trib
    Apr 15, 2019 @ 06:42
    Dave Woestenborghs
    0

    Hi Matt,

    It looks like you are using Models builder and something is wrong with your generated models.

    Can you have a look in the developer section and go to the models builder dashboard and see how it is configured.

    Dave

  • Matt 171 posts 445 karma points
    Apr 15, 2019 @ 21:27
    Matt
    0

    Hello Dave,

    Thanks for reply here is my models builder dashboard;

    ModelsBuilder is enabled, with the following configuration

    •The models factory is enabled.

    •The API is neither installed nor enabled. External tools such as Visual Studio cannot use the API.

    •PureLive models are enabled.

    •Models namespace is Umbraco.Web.PublishedContentModels.

    •Static mixin getters are enabled. The pattern for getters is "Get{0}".

    •Tracking of out-of-date models is not enabled.

  • Dave Woestenborghs 3193 posts 10608 karma points MVP 4x admin c-trib
    Apr 16, 2019 @ 05:52
    Dave Woestenborghs
    0

    Hi Matt,

    I think it has to do with security settings on your VPS.

    Modelsbuilders in PureLive mode needs to be able to run the roslyn compiler (the exe files in \bin\roslyn)

    What you can on your local machine is change the Modelsbuilder mode to "Dll" in the web.config file.

    After that go in Modelsbuilders dashboard again and click the "Generate Models" button.

    After that transfer your local bin folder and web.config (or change the one on the vps) to your VPS machine.

    Dave

  • Matt 171 posts 445 karma points
    Apr 16, 2019 @ 06:47
    Matt
    0

    Hello Dave,

    I changed Modelsbuilder mode to Dll and generated the models but still no joy, I'll try make contact with with my VPS provider and see if its an issue with security.

    Although my host EUKhost was recommended by this forum by a few people so I would hope that it shouldn't have any issues

  • Matt 171 posts 445 karma points
    Apr 16, 2019 @ 20:24
    Matt
    0

    Hello Dave,

    I made those changes but still no joy.

    They are saying that the VPS is setup correctly.

    Do you have any other suggestions?

    Thanks

  • Dave Woestenborghs 3193 posts 10608 karma points MVP 4x admin c-trib
    Apr 17, 2019 @ 05:38
    Dave Woestenborghs
    0

    Hi Matt,

    Can you maybe post some code of your template ?

    Dave

  • Matt 171 posts 445 karma points
    Apr 17, 2019 @ 12:44
    Matt
    0

    Hello Dave,

    @{
         var homeNode = Model.Content.Site().OfType<Home>();
        @Html.Partial("ExampleNavigation", homeNode.MainNavigation)
    }
    

    This is my parctial view, if I remove it from my master template the website will load fine (Although then I wont have a navigation)

    And here is my navigation partial

    @using Cogworks.Meganav.Models
    @model IEnumerable<MeganavItem>
    
        <div data-collapse="medium" data-animation="default" data-duration="400" class="navbar w-nav">
        <div class="w-container">
            <a href="#" class="brand w-nav-brand">
                    <h2 class="logo">Salt &amp; Pepper</h2>
                    <h3 class="logo2">Vintage</h3>
                </a>
        <nav role="navigation" class="nav-menu-mobile w-nav-menu">
    
          @foreach(var topLevelEntry in Model)
            {
             if(topLevelEntry.Children != null && topLevelEntry.Children.Any())
                {
        <div data-hover="1" data-delay="0" class="drop-down-menu w-dropdown">
        <div class="nav-link w-dropdown-toggle">
        <div>@topLevelEntry.Title</div>
        </div>
        <nav class="w-dropdown-list">
            @RenderChildren(topLevelEntry.Children)
        </nav>
        </div>
        }else{
        <a href="@topLevelEntry.Url" class="link w-nav-link">@topLevelEntry.Title</a>
                    }
            }
        </nav>
        <div class="menu-button w-nav-button">
        <div class="icon w-icon-nav-menu"></div>
                </div>
            </div>
    
            @helper RenderChildren(IEnumerable<MeganavItem> items)
    {
        if (items.Any())
        {
            foreach (var item in items)
            {        
                <a href="@item.Url" class="dropdown-link w-dropdown-link">@item.Title</a>
            }
        }
    }  
    
  • Matt 171 posts 445 karma points
    Apr 25, 2019 @ 07:10
    Matt
    0

    Hello all,

    Any ideas? I may have to remove the meganav and look at something else. Although its just strange how it works on my localhost.....

    Thanks

  • Dave Woestenborghs 3193 posts 10608 karma points MVP 4x admin c-trib
    Apr 25, 2019 @ 07:12
    Dave Woestenborghs
    0

    Hi Matt,

    No Ideas really

    Maybe not everything got pushed to your VPS correctly.

    Dave

  • Matt 171 posts 445 karma points
    Apr 28, 2019 @ 14:16
    Matt
    0

    Hmm cheers Dave,

    Its really frustration why it doesn't work.

    Works fine on local host and on 1&1 hosting. But does not work on EukHostvps

  • Matt 171 posts 445 karma points
    Apr 29, 2019 @ 07:56
    Matt
    0

    I had a phone cal from Eukhost this morning who said they get the same error when they moved the website to shared hosting and insist that its a code issue rather then a server.....

    I just find it hard to believe when it works on my local host and 1&1

  • Dave Woestenborghs 3193 posts 10608 karma points MVP 4x admin c-trib
    Apr 29, 2019 @ 08:12
    Dave Woestenborghs
    0

    Hi Matt,

    To me it seems like a permission issue

    Have you tried all the healthchecks in the developer dashboard to see if anything is not set up correctly.

    Dave

Please Sign in or register to post replies

Write your reply to:

Draft