简体   繁体   English

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

[英]MVC Application Fileresult get ERR_CONNECTION_REFUSED on pdf

I am trying to get a pdf from a get request but it fails. 我正在尝试从get请求中获取pdf,但失败。 When i check console in chrome i get GET http://localhost:50673/Logbook/PrintPage?bilder=checked net::ERR_CONNECTION_REFUSED. 当我在chrome中检查控制台时,我得到GET http:// localhost:50673 / Logbook / PrintPage?bilder = checked net :: ERR_CONNECTION_REFUSED。 Some IIS issuse? 一些IIS issuse? I run this directly in visual studio 2013. 我直接在Visual Studio 2013中运行此程序。

I have tried this code, 我已经尝试过此代码,

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

Fixed it, got a jquery loadevent that fired on actionlink class. 修复它,得到了一个在actionlink类上触发的jquery loadevent。 Got an annoying alert in firefox, chrome did not alert me. 在Firefox中收到了烦人的警报,Chrome并没有提醒我。 Try diffrent browsers is my suggestion. 我建议使用其他浏览器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM