Copied to clipboard

Flag this post as spam?

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


  • Peter Cort Larsen 421 posts 1038 karma points
    Feb 16, 2015 @ 20:09
    Peter Cort Larsen
    0

    DynamicMedia and Model.MediaById not working

    Hi,

    After moving a 4.7.1.1 solution to a new server, we got problems with these razor statements:

    var mediaItem = Model.MediaById(item.Element("slideshowImage").Value);
    DynamicMedia media = new DynamicMedia(item.Element("slideshowImage").Value);

     

    They throw an error saying:

    Error Loading Razor Script (file: Front Page Slideshow) The type initializer for 'Examine.ExamineManager' threw an exception.    at Examine.ExamineManager.get_Instance()
      at umbraco.MacroEngines.ExamineBackedMedia.GetUmbracoMedia(Int32 id)
      at umbraco.MacroEngines.DynamicBackingItem..ctor(Int32 Id)
      at umbraco.MacroEngines.DynamicNode..ctor(String NodeId)
      at umbraco.MacroEngines.DynamicMedia..ctor(String mediaId)
      at ASP._Page_macroScripts_FrontPageSlideShow_cshtml.Execute() in d:\web\tican.dk\www\macroScripts\FrontPageSlideShow.cshtml:line 28
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
      at System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors)
      at System.Web.WebPages.WebPage.ExecutePageHierarchy()
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
      at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage)
      at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage)

     

  • Mike 35 posts 100 karma points
    Feb 16, 2015 @ 20:13
    Mike
    0

    Check to make sure that the media cache has been generated.

    One thing you can do to see if it's the cache would be to go to the media item in question and "save" it.  Then check to see if the code now works. 

  • Peter Cort Larsen 421 posts 1038 karma points
    Feb 17, 2015 @ 14:48
    Peter Cort Larsen
    0

    Hi,

    Thanks for your answer. How do i check to see, if the media cache has been generated?

  • Mike 35 posts 100 karma points
    Feb 17, 2015 @ 15:19
    Mike
    0

    There's an API that can be called to regenerate media cache / examine indexes, but since this seems to be just a slideshow that we're talking about.  Go to the media section and resave each slideshow media item.

     

  • Peter Cort Larsen 421 posts 1038 karma points
    Feb 17, 2015 @ 15:27
    Peter Cort Larsen
    0

    its actually all images

Please Sign in or register to post replies

Write your reply to:

Draft