I struggle quite a complicated scenario to which I cannot find the answer.
I am trying to create a REST service with ASP.NET WebAPI which serves as a wrapper for file operations on a server. Therefore I am trying build an API like System.IO.File
and System.IO.Directory.
With System.IO.File
comes the method Create
which opens a Stream to the newly created file. The stream is writable so that it can be used to write content to the new file.
For my purpose I need to achieve this behaviour for my service as well. So the response should return a writable stream to the client and the this way the client can write data to the server.
I tried using StreamContent
but it cannot be used with a stream that is only writable. It says "Reading is not supported on this stream." along with throwing a NotSupportedOperationException
.
Is there any way I can pass a writable stream back to my client?
Thanks in advance.