InvalidOperationException: Response Content-Length mismatch

FileStreamResult 抛出异常:

InvalidOperationException: Response Content-Length mismatch

解决方案:

Stream 必须 seek begin

伪代码如下:

 Stream ms = new MemoryStream();
 book.Write(ms);
 ms.Seek(0, SeekOrigin.Begin); //seek begin
 return ms;

猜你喜欢

转载自www.cnblogs.com/CnKker/p/12170660.html