Upload to SharePoint fails due to upload limit in webservice

Hello everyone,

I just used an example from the web to use the copy.asmx webservice to upload files to a document library:
http://www.ktskumar.com/blog/2009/03/upload-document-from-local-machine-to-sharepoint-library/

It works fine but only if the file is very small (<1MB). If it is larger I get the error "underlying connection was closed". A first search shows that it seems to be a problem with the messagesize which has to be changed. However, everywhere in the web they speak about a setting in the web.config

Well in my project there is no web.config because I used the example in the link above. No is there another way to change the message size (e.g. by code)?

Thanks!!
Best,
Chris

April 26th, 2014 8:54pm

Hi Chris,

What version of SharePoint? SharePoint online? On Premise? How big of a file are you trying to upload?

Either way SharePoint leverages IIS to present the user interface and Web Services. Your code is still connecting to an instance of SharePoint and trying to directly upload to a document Library. The file size limits still apply. If I recall correctly IIS default is somewhere around 30megs. SharePoint 2010 is 50Megs. 

I would suggest adjusting the web.config and restarting IIS after.

http://blogs.technet.com/b/sharepointcomic/archive/2010/02/14/sharepoint-large-file-upload-configuration.aspx

http://support.microsoft.com/kb/925083/en-us

I would keep looking at the web config settings, could be a timeout issue, is .Net updated?

Hope this helps :)

Scott

Free Windows Admin Tool Kit Click here and download it now
April 26th, 2014 11:08pm

Hi,

uploading the files vie Browser works fine. It only fails with my own program. I think it is a problem of my own program. My problem is that there is no web.config file in my solution so I don't know how to change the max size of the messages...

Thanks!
Best,
Chris

April 27th, 2014 6:05am

from browser, it will upload file using server object model. you can change the upload size for same in CA.

as far as uploading file programatically using service, you can run the below script on server and it will resolve the issue

$ws = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$ws.ClientRequestServiceSettings.MaxReceivedMessageSize = 262144000
$ws.ClientRequestServiceSettings.MaxParseMessageSize  = 262144000
$ws.Update()

Note: 262144000 = 250 MB
Free Windows Admin Tool Kit Click here and download it now
April 28th, 2014 6:12am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics