The other day I was working on an application that would be uploading files to SharePoint 2013 using BizTalk 2013.
With BizTalk 2013, Microsoft has introduced CSOM (Client Side Object Model) and as a result of which there no need to install the SharePoint Service that was required till BizTalk 2010.
Everything seems to be working fine till I tried uploading a file of size 1.8 MB and BizTalk failed to upload the file with below exception.
So the error is clearly the server exception and SharePoint is not allowing files of size > 2097152 byes or approx 2MB.
There is one interesting stuff to check here.. The file size being uploaded is 1.8 MB and allowed size is 2 MB so why is it failing ??
After digging on to SharePoint logs I could see the content of the file and voila the content is a Base64 string. So this clarified the reason as Base64 string is greater than the original data so a 1.8MB data could well grow > 2MB after Base64 conversion..
But still a 2MB limitation is too much and it should not be like this.
There is a setting in SharePoint where you can increase this size limit. It can be done using a power shell script.
$service = [Microsoft.Sharepoint.Administration.SPWebService]::ContentService
$service.ClientRequestServiceSettings.MaxParseMessageSize = 2147483647
$service.ClientRequestServiceSettings.MaxReceivedMessageSize = 2147483647
Using the above script the size can be increased to 2 GB and after running the script everything went fine and files of size 200, 250 MB were getting successfully uploaded.
Note : Its the MaxParseMessageSize that actually does the trick 🙂