the request message is too big. the server does not allow messages larger than 2097152 bytes SharePoint online
Check out Best Alternative to InfoPath -> Try Now
This SharePoint Online tutorial we will discuss how to solve the request message is too big. the server does not allow messages larger than 2097152 bytes error which comes in Visual Studio workflow in SharePoint Online.
Recently while working with SharePoint online workflow development with visual studio 2015 project, we got the below error while saving the workflow definition file inside the host web.
We were writing the below code to save the workflow definition file from app web to host web. But it through the below exception in the SaveDefinition method.
WorkflowDeploymentService wfDeploymentService = wfServicesManager.GetWorkflowDeploymentService();
foreach (KeyValuePair<string, string> keyValPair in wfDictionary)
WorkflowDefinition workflowDef = new WorkflowDefinition(ctx);
workflowDef.Xaml = keyValPair.Value;
workflowDef.DisplayName = keyValPair.Key;
The error comes as:
An unhandled exception of type ‘Microsoft.SharePoint.Client.ServerException’ occurred in Microsoft.SharePoint.Client.Runtime.dll
Additional information: the request message is too big. the server does not allow messages larger than 2097152 bytes
Solution (SharePoint online):
This a file size limit imposed by Microsoft within SharePoint Online to prevent uploading file size larger than 2MB. Even if the limit is 2MB, maximum time it does not allow to save even file size more than 1.7MB. So we need to make sure the workflow definition file should not increase beyond the limit. Below are a few things you can try:
- Remove the unused workflow actions
- If you have used more WriteToHistory actions then try to remove the unnecessary actions.
- Also, we need to remember one more thing is that the weight of different workflow action is different from one another. Like if WriteToHistory is having less size than Calling a Rest API using HttpSend activity.
In SharePoint online, we can not increase the limit also. So we have to optimize our workflow.
Solution (SharePoint 2013):
If the above error is coming for SharePoint on premise environment then we can increase the upload size limit by using PowerShell. Below is the PowerShell command which we can run in the front end servers. Then do an IISREST and the error should not come.
$ws = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$ws.ClientRequestServiceSettings.MaxReceivedMessageSize = 5120000
$ws.ClientRequestServiceSettings.MaxParseMessageSize = 5120000
The above command will increase the upload limit from 2MB to 5MB.
You may like following SharePoint workflow tutorials:
- SharePoint Approved and Rejected buttons not appearing in task form in Visual Studio 2015 workflow
- Packaging and Deploying in SharePoint 2013 designer workflow
- How to retrieve workflow id by using jsom in SharePoint online?
- How to send email in visual studio 2015 workflow in SharePoint hosted add-in in SharePoint online?
- Activate Workflows can use app permissions Feature programmatically using C#.Net .net managed object model code
- Impersonation step missing in SharePoint 2013 Workflow
- How to Trigger Sharepoint 2013 Designer workflow on a list item by calling REST API using jQuery?
- Deploy SharePoint 2013 designer workflow into production in SharePoint online
- SharePoint Online Create Workflow History List using PowerShell or using SharePoint Designer 2013
Hope this will be helpful to solve an issue the request message is too big. the server does not allow messages larger than 2097152 bytes SharePoint online.
SharePoint Online FREE Training
JOIN a FREE SharePoint Video Course (3 Part Video Series)