How do I upload large (> 25MB) files to a web service?

后端 未结 8 1828
野趣味
野趣味 2020-12-07 15:56

I have a web service that takes a byte[] and saves it.

This works fine for \"small\" files, but once I hit a certain size the web service fails and returns \"The req

相关标签:
8条回答
  • 2020-12-07 16:41

    If you're set on using Web Services to move around files I would at least consider using WS-Attachment / DIME attachments. The primary problem with sending byte[]'s over web services is that they get put in the SOAP body which is gets encoded as a base 64 string. Encoding files like this grows the size of the file by as much as two thirds in the soap body (ie. a 6 MB file becomes a 9 MB file over the wire).

    It's likely that your 25 MB upload is turning into HUGE soap envelopes.

    I'd strongly suggest reading this. Which might get you into DIME.

    Here's an excerpt.

    Microsoft's WSE Toolkit allows large attachments to be sent along with a Web service method using the DIME and WS-Attachments standards. We'll examine these standards and why they are more efficient than sending large amounts of binary data in a Web service call through other common means.

    Hope that helps!

    0 讨论(0)
  • 2020-12-07 16:45

    This doesn't specifically answer you question, but what I've done in the past is use WCF to transfer file names/paths/listings, but then use an FTP library to transfer the file via FTP.

    0 讨论(0)
提交回复
热议问题