Return file in ASP.Net Core Web API

If this is ASP.net-Core then you are mixing web API versions. Have the action return a derived IActionResult because in your current code the framework is treating HttpResponseMessage as a model. [Route(“api/[controller]”)] public class DownloadController : Controller { //GET api/download/12345abc [HttpGet(“{id}”)] public async Task<IActionResult> Download(string id) { Stream stream = await {{__get_stream_based_on_id_here__}} if(stream == null) … Read more