JQuery-Upload: unexpected token

While working with the JQuery-Upload control, I encountered the following error:

unexpected token <

The real kicker was the fact that my target file was still being created.

The cause of the problem (as I eventually discovered) was my REST contract; my endpoint as configured as follows:

[OperationContract]
[WebInvoke(Method = "POST",
ResponseFormat = WebMessageFormat.Xml,
BodyStyle = WebMessageBodyStyle.WrappedResponse,
UriTemplate = "/file/upload")]
StatusData Upload(Stream fileData);

but my endpoint was returning a JSON response.

This resulted in a mismatch, as the expected response format was XML.

Changing the contract to Json resolved the problem.

Comments

Popular posts from this blog

SharePoint 2013: Error updating managed account credentials

Error deploying Nintex workflow: An item with the same key has already been added