1
私はHttpHandlerをミドルウェアサービスに置き換えています。実際の画像を返す以外はすべてのコードが動作しています。既存のサンプルはすべてasp.net Core(またはそれ以前)用ですが、asp.net core 1.1では応答オブジェクトに変更がありますか?ASP.Net Core 1.1ミドルウェアの応答
public async Task Invoke(HttpContext context)
{
var mediaType = new MediaTypeHeaderValue("image/jpeg");
mediaType.Encoding = System.Text.Encoding.UTF8;
context.Response.ContentType = mediaType.ToString();
byte[] results = some process that generates a byte array
Stream stream = new MemoryStream(results);
context.Response.Body = stream;
await _next.Invoke(context);
}
どのようにバイト配列をレスポンスオブジェクトにアタッチしますか?
おかげで、これは私の問題への正確なソリューションでした –