...
MemoryStream ms = new MemoryStream();
using(MemoryStream tempStream = new MemoryStream)
workbook.Write(tempStream);
var byteArray = tempStream.ToArray();
ms.Write(byteArray, 0, byteArray.Length);
HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);