1

I'm working on an image processing service that has two layers. The top layer is a REST based WCF service that takes the image upload, processes and the saves it to the file system. Since my top layer doesn't have any direct database access (by design) I need to pass the image to my application layer (WsHTTPBinding WCF) which does have database access. As it stands right now, the images can be up to 2MB in size and I'm trying to figure out the best way to transport the data across the wire.

I currently am sending the image data as a byte array and the object will have to be stored in memory at least temporarily in order to be written out to the database (in this case, a MySQL server) so I don't know that using a Stream would help eliminate the potential memory issues or if I am going to have to deal with potentially filling up my memory no matter what I do. Or am I just over thinking this?

thaBadDawg
  • 5,160
  • 6
  • 35
  • 44

1 Answers1

2

Check out the Streaming Data section of this MSDN article: Large Data and Streaming

I've used the exact method described to successfully upload large documents and even stream video contents from a WCF service. The keys are to pass a Stream object in the message contract and setting the transferMode to Streaming in the client and service configuration.

I saw this post regarding efficiently pushing that stream into MySQL, hopefully that gets you pointed in the right direction.

Community
  • 1
  • 1
Nick Patterson
  • 934
  • 8
  • 11