MVC 应用程序文件结果在 pdf 上得到 ERR_CONNECTION_REFUSED

MVC Application Fileresult get ERR_CONNECTION_REFUSED on pdf

我正在尝试从获取请求中获取 pdf,但失败了。当我在 chrome 中检查控制台时,我得到 GET http://localhost:50673/Logbook/PrintPage?bilder=checked net::ERR_CONNECTION_REFUSED。某些 IIS 问题?我运行这个直接在visual studio2013.

我试过这个代码,

    [AsyncTimeout(150)]
    [HttpGet]
    public async Task<FileResult> PrintPage(bool bilder = false)
    {
        --------
     --------
      --------
      --------
    System.IO.FileInfo file =         AsposePDFBuilder.PdfBuilder.ExportForPrint(exportData, hidePronAoInfo, true);

        //System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
        //response.ClearContent();
        //response.Clear();
        //response.ContentType = "application/pdf";
        //response.AddHeader("Content-Disposition", "attachment; filename=\"" + file.Name + "\"");
        //response.TransmitFile(file.FullName);
        //response.End();
        ViewBag.Result = "Export är nedladdad";

        return File(file.FullName, "application/pdf");

修复了它,得到了一个在 actionlink class 上触发的 jquery 加载事件。在 firefox 中收到烦人的警报,chrome 没有提醒我。尝试不同的浏览器是我的建议。