Copied to clipboard

Flag this post as spam?

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


  • Craig100 1136 posts 2523 karma points c-trib
    Sep 18, 2015 @ 12:07
    Craig100
    0

    GetResponsiveCropURL Installation Specific Problem

    On a 7.2.2 site we're getting the following error message on the live site. Everything works fine on the dev and test sites. I've recopied DLL's Views and Partial Views, rechecked and saved crops in the Image Cropper DataType, and the Media items themselves, cleared caches and republished the whole site. Just cannot pin this one down. As it's the live site I don't want to do a full upload just yet. Can anyone point me at where else I can look for this fault?

    An unhandled exception occurred
    Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'Umbraco.Web.Models.PublishedContentBase' does not contain a definition for 'GetResponsiveCropUrl'
       at CallSite.Target(Closure , CallSite , Object , String )
       at ASP._Page_Views_Partials_accessoryListing_cshtml.Execute() in d:\home\site\wwwroot\Views\Partials\accessoryListing.cshtml:line 13
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
       at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
       at Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer)
       at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
       at ASP._Page_Views_AccessoryList_cshtml.Execute() in d:\home\site\wwwroot\Views\AccessoryList.cshtml:line 8
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
       at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
       at Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer)
       at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
       at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17()
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult)
       at System.Web.Mvc.Controller.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult)
       at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
       at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
       at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
       at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult)
       at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    

    I should also mention, I've proved imageprocessor is working by calling a media item with a width querystring.

    Thanks,

    Craig

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Sep 18, 2015 @ 12:11
    Jeavon Leopold
    0

    Hi Craig,

    Can you ensure you have the same /Views/Web.config, I think you are missing the namespace that is added there?

    Jeavon

  • Craig100 1136 posts 2523 karma points c-trib
    Sep 18, 2015 @ 12:36
    Craig100
    0

    Thanks Jeavon, the /Views/Web.config files are identical :(

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Sep 18, 2015 @ 12:42
    Jeavon Leopold
    0

    Strange, could you post the contents of /views/web.config?

  • Craig100 1136 posts 2523 karma points c-trib
    Sep 18, 2015 @ 12:50
    Craig100
    0

    Sure:-

    <?xml version="1.0" encoding="utf-8"?>
    
    <configuration>
      <configSections>
        <sectionGroup name="system.web.webPages.razor"
          type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
          <section name="host"
            type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
            requirePermission="false"/>
          <section name="pages"
            type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
            requirePermission="false"/>
        </sectionGroup>
      </configSections>
    
      <system.web.webPages.razor>
        <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <pages pageBaseType="System.Web.Mvc.WebViewPage">
          <namespaces>
            <add namespace="System.Web.Mvc"/>
            <add namespace="System.Web.Mvc.Ajax"/>
            <add namespace="System.Web.Mvc.Html"/>
            <add namespace="System.Web.Routing"/>
          <add namespace="Umbraco.Web"/><add namespace="Umbraco.Core"/><add namespace="Umbraco.Core.Models"/><add namespace="Umbraco.Web.Mvc"/><add namespace="umbraco"/><add namespace="Examine"/><add namespace="Our.Umbraco.PropertyConverters.Models"/>
          <add namespace="Slimsy"/>
          </namespaces>
        </pages>
      </system.web.webPages.razor>
    
      <appSettings>
        <add key="webpages:Enabled" value="false"/>
      </appSettings>
    
      <system.web>
        <httpHandlers>
          <add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
        </httpHandlers>
    
        <!--
            Enabling request validation in view pages would cause validation to occur
            after the input has already been processed by the controller. By default
            MVC performs request validation before a controller processes the input.
            To change this behavior apply the ValidateInputAttribute to a
            controller or action.
        -->
        <!--
            Enabling request validation in view pages would cause validation to occur
            after the input has already been processed by the controller. By default
            MVC performs request validation before a controller processes the input.
            To change this behavior apply the ValidateInputAttribute to a
            controller or action.
        --><pages validateRequest="false"
          pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
          pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
          userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
          <controls>
            <add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc"/>
          </controls>
        </pages>
      </system.web>
    
      <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
    
        <handlers>
          <remove name="BlockViewHandler"/>
          <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler"/>
        </handlers>
      </system.webServer>
    </configuration>
    
  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Sep 18, 2015 @ 12:56
    Jeavon Leopold
    0

    Looks fine, you could try adding @using Slimsy; at the top of the view even though it shouldn't be needed

  • Craig100 1136 posts 2523 karma points c-trib
    Sep 18, 2015 @ 13:08
    Craig100
    0

    Tried that, no difference. The error is called on the @if(productImage != null) { Line:-

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @using Slimsy;
    @{
        var productList = CurrentPage.Children("AccessoryItem").Where("Visible");
    
        foreach(var product in productList) {
            var sku = product.GetPropertyValue("Sku");
            var productImage = product.GetPropertyValue<IPublishedContent>("productImage");
        <section class="productpage-section">          
            <div class="row features-boxes product-border">
                <div class="col-l-3 col-m-3 col-s-3">
                    <div class="productimg-lft ortac">
                    @if(productImage != null) {
                        <a href="@product.Url" title="@product.productName"><img src="@productImage.GetResponsiveCropUrl("AccessoryShot")" alt="@productImage.Name"></a>
                    }   
                    </div>
                </div><!--col-l-3-->
    
                <div class="col-l-6 col-m-6 col-s-6">
                    <div class="product-summary">
                        <h2 class="ortac">@product.productName</h2>             
                        @product.summary
                    </div>
                </div><!--col-l-6-->        
    
                <div class="col-l-3 col-m-3 col-s-3 productprice-rgt">        
    
                    <div class="text-center product-page-addtobasket-top-margin accessories-price-font">
                            <div class="priceDiv" data-sku="@sku"></div>
                    </div><!--text-center-->
    
                    <div class="row">
                        <div class="col-l-3"></div>
                        <div class="col-l-6 ortac btnprice product-page-addtobasket-bottom-margin">
                            <button type="submit" data-sku="@sku" class="buy-now-acc submit-btn yellow-round-button">@(Umbraco.GetDictionaryValue("[Products] Buy Now"))</button>
                        </div>
                    </div>
                    <div class="col-l-3"></div>
                    <div class="clearfix"></div>        
                </div><!--col-l-3 productprice-rgt-->
            </div>  
        </section> 
        }
    }
    
  • Craig100 1136 posts 2523 karma points c-trib
    Sep 18, 2015 @ 13:23
    Craig100
    0

    Just wondering if it's safe to uninstall and reinstall Slimsy on a live site.

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Sep 18, 2015 @ 13:47
    Jeavon Leopold
    0

    Could you double check the Slimsy.dll is in the bin folder?

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Sep 18, 2015 @ 13:49
    Jeavon Leopold
    0

    Could try calling the method directly

    @Slimsy.GetResponsiveCropUrl(productImage, "AccessoryShot");
    
  • Craig100 1136 posts 2523 karma points c-trib
    Sep 18, 2015 @ 16:28
    Craig100
    0

    Changing

    <a href="@product.Url" title="@product.productName"><img src="@productImage.GetResponsiveCropUrl("AccessoryShot")" alt="@productImage.Name"></a>
    

    to

    <a href="@product.Url" title="@product.productName"><img src="@Slimsy.GetResponsiveCropUrl(productImage, "AccessoryShot")" alt="@productImage.Name"></a>
    

    fixes the problem on this particular installation. So does that give any clues as to what's missing?

  • Craig100 1136 posts 2523 karma points c-trib
    Sep 18, 2015 @ 22:34
    Craig100
    0

    Slimsy.dll is in the bin folder.

  • Craig100 1136 posts 2523 karma points c-trib
    Sep 21, 2015 @ 10:21
    Craig100
    0

    Can anyone explain the above so I can get the live site working with the same code as the dev and test sites? It looks to me like there's a reference missing, but Slimsy works everywhere else in the site apart from in this partial view so I doubt it's that.

    Both test and live sites are hosted on Azure, if it makes a difference.

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Sep 21, 2015 @ 14:38
    Jeavon Leopold
    100

    Hi Craig,

    Could you try changing

        var productImage = product.GetPropertyValue<IPublishedContent>("productImage");
    

    to

    var productImage = product.productImage;
    

    and see if it makes any change?

    Jeavon

  • Craig100 1136 posts 2523 karma points c-trib
    Sep 21, 2015 @ 15:49
    Craig100
    0

    Hi Jeavon,

    I tried that earlier with no luck. However, just in case, I tried it again and it worked. Must have had slightly different conditions last time.

    Although it doesn't explain why one installation needs it while the others don't, I tend to agree that it looks a more sensible solution to the problem so will mark this as the answer.

    Thanks again.

Please Sign in or register to post replies

Write your reply to:

Draft