Tag Archives: BadRequest

HTTP 400 BadRequest – SharePoint 2013 Workflow

Issue

I created a simple SharePoint Designer 2013 workflow.  The workflow only has a couple activities – sending and email and copying the document to another library.  When the workflow reached the copy document step, it would constantly pause and you would see and error such as the following on the workflow status page:

image

Activity in progress

Retrying last request. Next attempt scheduled in less than one minute. Details of last request: HTTP BadRequest to https://myserver.fqdn/sites/teamsite/_vti_bin/client.svc/web/getfilebyserverrelativeurl(‘/sites/teamsite/FormLibraryName/FormInstanceName_2015_06_01_12_00_00.xml’)/CopyTo(strNewUrl=’/sites/teamsite/SecondLibraryName/FormInstanceName_2015_06_01_12_00_00.xml’,%20bOverWrite=’false’) Correlation Id: 62600f9d-24c3-9060-8a21-d4689f426f96 Instance Id: 11915cf9-2e82-49ae-ae04-3e93dcef731c

Cause

The reason that this happens is that the URL that is being requested to get data via the client API (client.csv) is longer than the default IIS setting of 260 characters.  The part that is in bold above is the request that the workflow is making, which in this case is 281 characters.  Microsoft should update the default settings in IIS for the ISAPI virtual directory, but lucky for us, they don’t.

Solution

Update the web.config file in the ISAPI virtual directory on each of your SharePoint servers:

C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\web.config

Add this:

<httpRuntime maxUrlLength=”4096″ />

Here is what it should look like:

image

By putting this in the ISAPI virtual directory’s web.config, the change will apply to all SharePoint web applications.  You could put this in the web application’s web.config, but that is a lot of extra work.  It would also then make the max URL length change for all pages in the web app, not just the ISAPI services.