Don't use
.Result
to force an asynchronous operation to run synchronously. You can just make your action
async
and
await
the operation.
But in this case, you don't need the
ByteArrayContent
at all. Just use the
StreamContent
directly.
responseMsg.Content = new StreamContent(rd.ExportToStream(ExportFormatType.PortableDocFormat), 1024 * 1024);