0
votes

I am trying to upload files to my WCF service using streaming to upload large files. All of this works fine using a normal client (like a ASP.net page). In Silverlight however I get the following error: Timeouts are not supported on this stream

I am uploading via a memorystream and I assume the issue is basically because instead of calling the synchronous method in Silverlight I am forced to call the async method. So it is this that doesn't like the normal memorystream. I have tried to find some other stream to use but it seems like either they are not supported in silverlight (bufferedstream, networkstream) or break the method (generic stream which for some reason MUST be the only parameter of the method to be used). Am I missing something here? I originally was using a byte array but there are too many size limitations there for what I need to allow to be uploaded.

I can insert my code here but since everything works flawlessly with my ASP.net test client I am assuming my bindings and code are fine.

1
are you uploaind data in "chunks"?Mazhar Karimi
No I am just calling the method on the service that accepts the memory stream and passing it the stream as the parameter.Mark

1 Answers

0
votes

There are three separate issues here:

1) Can you use the Stream type in your contract?

2) Can you get true streaming behavior on the client? (E.g. upload 2GB file without allocating 2GB of memory anywhere in the stack - including the underlying HTTP stack)

3) Can you get true streaming behavior on the server?

As far as I remember, the answers to #1 and #2 are "no" in Silverlight (though it may have changed in SL4.0). So the best you can achieve is #3. For example, you can try some trick with having a byte[]-based contract on the Silverlight side that results in the same XML projection as a Stream-based contract on the server side. Or, have byte[] on the client side and read from the Message class directly on the server side.

But my recollection about #1/#2 may be wrong...