Rotativa ActionAsPdf()很慢 [英] Rotativa ActionAsPdf() Very Slow

查看:650
本文介绍了Rotativa ActionAsPdf()很慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Rotativa 1.6.4的NuGet ,并已经注意到使用$ C $以下问题下面C。

ActionAsPdf随机挂起的时间不确定量。

低于code是悬:

  VAR pdfResult =新ActionAsPdf(报告,新{ID = Request.Params [ID]})
    {
        饼干= cookieCollection,
        FormsAuthenticationCookieName = FormsAuthentication.FormsCookieName,
        CustomSwitches =--load-错误处理忽略
    };

背景信息,可以帮助:

该customSwitches是在使用中忽略了一个问题,文件调用wkhtmltopdf.exe使用ActionAsPdf,但它只是在wkhtmltopdf电话确实在code不燮preSS错误。

观测,使用和测试:

它的工作原理,但运行的应用程序(无论是否步进到code)的时候,它可以在10秒到击中pdfResult =新ActionAsPdf终于进入了报告的行动之间约4分钟的任意位置被调用。不能辨别什么在Visual Studio中的输出窗口实际发生的,没有错误被抛出,我已经找到。只是随机的缓慢过渡到报告()动作。

我可以通过URL直接运行报告()动作,它永远不会减慢像这样,是相当快速的生成PDF。我使用的是ActionAsPdf获得二进制文件保存到文件系统,并通过电子邮件,这是这样做的这个库的prescribed方法来发送运行它。

行为存在两个本地Windows 10开发框和远程服务器2008R2测试盒。两个箱子.NET 4.5.1,默认的IIS上的每个

我的问题有:

什么可能导致这种缓慢下来,如何纠正它的主意?


解决方案

我最终使用UrlAsPdf()而不是ActionAsPdf()和它的作品。似乎可能有一些问题与ActionAsPdf(),我已经向一个bug与在GitHub上循环搜索项目。该ActionAsPdf()仍然标记为测试版,所以希望它得到的固定在未来的版本或由社区。

Using Rotativa 1.6.4 from NuGet and have noticed the following issue using the code below.

ActionAsPdf hangs randomly for indeterminate amount of time.

Code below that is hanging:

   var pdfResult = new ActionAsPdf("Report", new {id = Request.Params["id"]})
    {
        Cookies = cookieCollection,
        FormsAuthenticationCookieName = FormsAuthentication.FormsCookieName,
        CustomSwitches = "--load-error-handling ignore"
    };

Background info that may help:

The customSwitches is in use to ignore a documented issue calling wkhtmltopdf.exe using the ActionAsPdf, but it does not suppress errors in the code only in the wkhtmltopdf call.

Observations, usage and testing:

It works but when running the application (whether or not stepping through code), it can be anywhere from 10 seconds up to about 4 minutes between hitting the pdfResult = new ActionAsPdf and finally entering into the "Report" action being called. Can't discern anything actually happening in the output window of Visual Studio, no errors are being thrown that I have found. Just random slow transition into the Reports() action.

I can run the Reports() action directly via URL and it never slows like this and is quite fast for PDF generation. I am running it using the ActionAsPdf to obtain the binary to save to file system and send via email, which is the prescribed method of doing so for this library.

The behavior exists on both a local Windows 10 dev box and a remote Server 2008R2 Test box. .Net 4.5.1 on both boxes, default IIS on each.

Questions I have:

Any idea on what might cause this slow down and how to remedy it?

解决方案

I ended up using UrlAsPdf() instead of ActionAsPdf() and it works. Seems there may be some issues with the ActionAsPdf() and I have filed a bug with Rotative project on GitHub. The ActionAsPdf() is still marked as beta, so hopefully it get's fixed in future versions or by the community.

这篇关于Rotativa ActionAsPdf()很慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆