【问题标题】:MVC Application Fileresult get ERR_CONNECTION_REFUSED on pdfMVC 应用程序文件结果在 pdf 上获得 ERR_CONNECTION_REFUSED
【发布时间】:2015-05-25 15:17:22
【问题描述】:

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

这个代码我试过了,

    [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");

【问题讨论】:

    标签: c# asp.net asp.net-mvc webforms async-await


    【解决方案1】:

    修复它,得到一个在 actionlink 类上触发的 jquery loadevent。在 Firefox 中收到烦人的警报,chrome 没有提醒我。我的建议是尝试不同的浏览器。

    【讨论】:

      猜你喜欢
      • 2014-02-02
      • 1970-01-01
      • 1970-01-01
      • 2016-02-09
      • 2015-10-26
      • 1970-01-01
      • 2020-10-14
      • 1970-01-01
      • 2017-11-28
      相关资源
      最近更新 更多