0

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.

2
  • I am not sure if this is what you looking for, but check this will help ? Commented Aug 21, 2017 at 14:20
  • Thanks for the answer, but I don't think so. It just produces an OutputStream which cannot be written by the client. Commented Aug 22, 2017 at 6:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.