因此,我在MVC api上有一个简单的react应用。一切似乎都可以找到,除了我有一个向用户提供PDF的端点。它在开发中工作正常,但是当我发布到Azure时,似乎React收到了Url请求,只显示了一个通用的404 Shell页面。当我远程调试应用程序时,它甚至没有命中终点。在开发中一切正常。
我正在使用一个简单的定位标记来导航至文件下载。 我应该做些不同的事情吗?
<a href='/api/path/RenderReport?pDocID=123'>Download File</a>
[HttpGet]
public FileResult RenderReport([FromQueryAttribute] string pDocID)
{
Response.ContentType = "application/pdf";
string fileName = _hostingEnvironment.ContentRootPath + ReportWriter.RenderReport(pDocID, _hostingEnvironment.ContentRootPath);
byte[] fileBytes = System.IO.File.ReadAllBytes(fileName);
System.IO.MemoryStream workStream = new System.IO.MemoryStream(fileBytes);
return File(workStream, "application/pdf", pDocID + "_report.pdf");
}