Ear*_*ven 4 c# asp.net-core-mvc asp.net-core asp.net-core-webapi
在下面有些人为的代码片段中,我创建了一个控制器方法,它构成 ASP.NET Core MVC API 的一部分。该方法用ProducesResponseType属性修饰,指示响应类型是 a 是否正确Stream,或者响应类型应该是FileStreamResult?
[HttpPost("APIFunctionCall")]
[ProducesResponseType(typeof(Stream), 200)]
public async Task<IActionResult> ProcessNewRequestAsync(Request request)
{
FileStream fs = File.Open(request.Path, FileMode.Open, FileAccess.Read, FileShare.None)
return returnValue = new FileStreamResult(fs, new MediaTypeHeaderValue("application/ms-word"));
}
Run Code Online (Sandbox Code Playgroud)
应该是FileStream或者FileStreamResult我会说
[ProducesResponseType(typeof(FileStreamResult), 200)]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3408 次 |
| 最近记录: |