Copied to clipboard

Flag this post as spam?

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


  • Hefin Jones 39 posts 161 karma points
    Jul 17, 2012 @ 20:33
    Hefin Jones
    0

    .MediaById(Id).umbracoFile / Shared Hosting

    Good Evening,

    I am experiencing a problem with an Umbraco instance hosted on a shared hosting service.  The issue seems to lie with the MediaById method in my Razor code.  I have created a razor script with just the following code:

    <img src="@Library.MediaById(1110).umbracoFile" class="" />

    And this causes the following error when using the ?umbDebugShowTrace=true:

     

    Error Loading Razor Script (file: Get Image By ID) The type initializer for 'Examine.ExamineManager' threw an exception.    
    at Examine.ExamineManager.get_Instance()
    at umbraco.MacroEngines.ExamineBackedMedia.GetUmbracoMedia(Int32 id)
    at umbraco.MacroEngines.Library.RazorLibraryCore.MediaById(Int32 Id)
    at ASP._Page_macroScripts_GetImageByID_cshtml.Execute()
    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)

     

    I have read that this maybe related to permissions on the server and I have been in touch with the hosting company support who say:

    It sounds like the specific module/method is not designed in such a way to be compatible with a shared hosting security model or it could be you need to specify another path or tweak the configuration, you would need to contact the application developers for further information on this though I'm afraid. 

    The script works fine locally on my laptop but as soon as I transfer it to hosting server (Medium Trust) - it fails with the above errors.

    Is there a way to get this working? Any help would be greatly appreciated!

    Cheers Guys.

  • AmandaEly 123 posts 379 karma points
    Aug 21, 2012 @ 11:23
    AmandaEly
    0

    This is happening to me too. It works fine locally but throws the same error on my local IIS7. Please send a fix for this, as it looks as if I can't use GetMediaById or, in my case @Model.Media("friendlyPicture"); 

Please Sign in or register to post replies

Write your reply to:

Draft