Sitecore Bulk Upload from the item itself - HTTP/2 error Resolution

We need to allow bulk image uploads directly from the Sitecore item rather than requiring users to navigate to the media library to upload images one by one or as a zip file. This feature enables the content author to be productive without going to the media library to upload images.

The image upload functionality works well when the content author uploads one or two images simultaneously, even when using a zip file. However, when attempting to upload a larger number of images, we encounter the following error




13380 09:38:06 ERROR Index was out of range. Must be non-negative and less than the size of the collection.

Parameter name: index
Exception: System.ArgumentOutOfRangeException
Message: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Source: mscorlib
at System.Collections.ArrayList.get_Item(Int32 index)
at System.Web.HttpFileCollection.Get(Int32 index)
at System.Web.HttpFileCollectionWrapper.get_Item(Int32 index)
at Sitecore.Controllers.MediaController.DoUpload(String database, String destinationUrl, Language itemLanguage)
at Sitecore.Controllers.MediaController.Upload(String database, String destinationUrl, String itemLanguage)


When we uploaded the same batch of images using the media library, all the images were successfully uploaded without any errors. 

It's important to note that we have set a maximum image size limit of 30MB for content authors. This means that a content author can upload any number of images, provided each image is 30MB or smaller.

We have configured the settings to allow for a maximum size of 30MB per image.


<setting name="Media.MaxSizeInDatabase" value="30MB" />

<requestLimits maxAllowedContentLength="524288000" />

<httpRuntime targetFramework="4.8" maxRequestLength="512000" executionTimeout="600" enableKernelOutputCache="false" relaxedUrlToFileSystemMapping="false" requestValidationMode="4.0" enableVersionHeader="false" requestValidationType="Sitecore.Web.RequestValidators.SitecoreBackendRequestValidator, Sitecore.Kernel" />

While uploading some of the images got uploaded and some got stuck and after some time it returned the error mentioned above.



We have tried various approaches and solutions but at last, we figured out the issue with the help of Sitecore Support.

The main reason for this issue is because of the HTTP/2 protocol error while uploading the images.

Solution:

To resolve this issue, we disabled HTTP/2 in IIS by following these steps.

  • Open Internet Information Services (IIS) Manager.
  • Select the CM instance of the Sitecore instance.
  • Click on the “Bindings” on the right panel.
  • Double-click on the site binding.
  • Tick “Disable HTTP/2”.
  • Click on “OK”.
  • Click on the server on the left panel.
  • Click on “Stop”.
  • Wait for a few seconds and then click on “Start”.



Let's learn and grow together, happy programming ðŸ˜Š






Comments

Popular posts from this blog

Custom Item Url and resolving the item in Sitecore - Buckets

Exploring Sitecore XM Cloud Forms: A Comprehensive Overview

Sitecore Custom Rule (Action and Condition)