The problem is your data contract - public System.IO.Stream FileByteStream; . Remove this member from the data contract and use stream in your work contract - for example:
[OperationContract(OneWay=true)] void UploadFile(RemoteFileInfo request, System.IO.Stream fileData);
Quote from Big Data and Streaming (MSDN):
You should not use the resulting System.IO.Stream types inside data contracts. Stream data should be streamed using the streaming model explained below under the Streaming Data section.
The Streaming Data section of the same link explains this in detail.
The problem is your data contract - public System.IO.Stream FileByteStream; . Remove this member from the data contract and use stream in your work contract - for example:
[OperationContract(OneWay=true)] void UploadFile(RemoteFileInfo request, System.IO.Stream fileData);
Quote from Big Data and Streaming (MSDN):
You should not use the resulting System.IO.Stream types inside data contracts. Stream data should be streamed using the streaming model explained below under the Streaming Data section.
The Streaming Data section of the same link explains this in detail.
EDIT: Apologies - I missed the limits. You have two ways to solve the problem: use MessageContract or use several operations for one transaction. An example of using multiple operations will be
[OperationContract] Token UploadFile(System.IO.Stream fileData); [OperationContract] void ProvideFileInfo(Token token, RemoteFileInfo request);
First, upload the data to the server, and the server issues a token (for example, guid), use the token to update other information.
A more preferable way would be to use MessageContract and which you have already tried. Some suggestions for troubleshooting:
- If your hosting is in IIS, check maxRequestLength in web.config. Try uploading small files.
- Instead of directly using the FromFile stream, store it on disk and use the stream on top of it. The reasoning behind the HTTP request stream can be cleared at boot time.
- Use a tool, such as a violinist, and see the message passing through the wire to the service, which may give the key.