levipadre
levipadre

Reputation: 619

Url request error when I use Umbraco backend

I got 404 request, when I try to see one of my saved node. The node has a multiple media picker with a lot of saved images. If I check a short one, it's working.

http://localhost:57643/umbraco/backoffice/UmbracoApi/Entity/GetByIds?ids=2118&ids=2114&ids=2120&ids=2122&ids=2121&type=Media

If I check the long one, I get the error:

http://localhost:57643/umbraco/backoffice/UmbracoApi/Entity/GetByIds?ids=3516&ids=2116&ids=2114&ids=2115&ids=2117&ids=2118&ids=2119&ids=2120&ids=2122&ids=2121&ids=2123&ids=2124&ids=2125&ids=2126&ids=2127&ids=2128&ids=2131&ids=2130&ids=2129&ids=2132&ids=2133&ids=2134&ids=2159&ids=2160&ids=2161&ids=2158&ids=2157&ids=2156&ids=2153&ids=2155&ids=2154&ids=2150&ids=2151&ids=2152&ids=2146&ids=2145&ids=2144&ids=2148&ids=2149&ids=2147&ids=2141&ids=2142&ids=2143&ids=2140&ids=2139&ids=2138&ids=2135&ids=2136&ids=2137&ids=2056&ids=2057&ids=2060&ids=2059&ids=1353&ids=1354&ids=1355&ids=1358&ids=1357&ids=1356&ids=1359&ids=1360&ids=1361&ids=1364&ids=1363&ids=1362&ids=1365&ids=1366&ids=1367&ids=1370&ids=1369&ids=1368&ids=2644&ids=2645&ids=2646&ids=2649&ids=2648&ids=2647&ids=2650&ids=2651&ids=2652&ids=2655&ids=2654&ids=2653&ids=2656&ids=2657&ids=2658&ids=2661&ids=2660&ids=2659&ids=2662&ids=2663&ids=2664&ids=2667&ids=2666&ids=2665&ids=2668&ids=2669&ids=2670&ids=2671&ids=2672&ids=2673&ids=2676&ids=2675&ids=2674&ids=2677&ids=2678&ids=2679&ids=2682&ids=2681&ids=2680&ids=2683&ids=2685&ids=2688&ids=2687&ids=2686&ids=2689&ids=2690&ids=2691&ids=2694&ids=2693&ids=2692&ids=2698&ids=2695&ids=2696&ids=2697&ids=2700&ids=2699&ids=2701&ids=2702&ids=2703&ids=2706&ids=2705&ids=2704&ids=2707&ids=2708&ids=2709&ids=2644&ids=2645&ids=2646&ids=2649&ids=2648&ids=2647&ids=2650&ids=2651&ids=2652&ids=2655&ids=2654&ids=2653&ids=2656&ids=2658&ids=2657&ids=2661&ids=2660&ids=2659&ids=2662&ids=2663&ids=2664&ids=2667&ids=2666&ids=2665&ids=2668&ids=2669&ids=2670&ids=2673&ids=2672&ids=2671&ids=2674&ids=2675&ids=2676&ids=2679&ids=2678&ids=2677&ids=2680&ids=2681&ids=2682&ids=2685&ids=2684&ids=2683&ids=2686&ids=2687&ids=2688&ids=2691&ids=2690&ids=2689&ids=2692&ids=2693&ids=2694&ids=2697&ids=2696&ids=2695&ids=2698&ids=2699&ids=2700&ids=2703&ids=2702&ids=2701&ids=2704&ids=2705&ids=2706&ids=2709&ids=2708&ids=2707&ids=2972&ids=2973&ids=2974&ids=2977&ids=2976&ids=2975&ids=2978&ids=2979&ids=2980&ids=2983&ids=2982&ids=2981&ids=2984&ids=2985&ids=2986&ids=2989&ids=2988&ids=2987&ids=2990&ids=2991&ids=2992&ids=2995&ids=2994&ids=2993&ids=2996&ids=2997&ids=2998&ids=3001&ids=3000&ids=2999&ids=3002&ids=3003&ids=3004&ids=3007&ids=3006&ids=3005&ids=3008&ids=3009&ids=3010&ids=3013&ids=3012&ids=3011&ids=3014&ids=3015&ids=3016&ids=3017&ids=3018&ids=3019&type=Media

Is this because the request url is too long or something else? If the length, how can I solve it?

Upvotes: 2

Views: 2510

Answers (1)

germankiwi
germankiwi

Reputation: 1132

I had the exact same problem. You can change the query string limit in the web.config, I recommend limiting this to the specific path needed using the <location> tag:

<location path="umbraco/backoffice/UmbracoApi/Entity">
  <system.web>
    <httpRuntime maxQueryStringLength="32768" maxUrlLength="65536" />
  </system.web>
  <system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxQueryString="32768"/>
      </requestFiltering>
    </security>
  </system.webServer>
</location>

Adjust the values as required.

Also note that if you pick more than say 80-100 images, you'll reach the database limit of the column umbraco stores the data in (dataNvarchar (nvarchar(500)) in the table cmsPropertyData).

To overcome this, make umbraco store the value in the dataNtext (ntext) column instead, by updating the value of dbType from Nvarchar to Ntext in the row for the Umbraco.MultipleMediaPicker property editor in the table cmsDataType.

Upvotes: 1

Related Questions