简体   繁体   English

TaskCanceledException:呈现jsreport时取消了任务

[英]TaskCanceledException: a task was cancelled while rendering jsreport

I'm trying to render a jsreport that contains too much data and when it takes too long to render shows me this message: 我正在尝试渲染包含太多数据的jsreport ,并且渲染时间太长会显示以下消息:

TaskCanceledException: a task was cancelled.

If I load less data the report works well. 如果我加载的数据较少,则报告效果很好。

My question is, there is a way to avoid TaskCanceledException and let the rendering time take what it has to take to render the report? 我的问题是,有一种方法可以避免TaskCanceledException并让呈现时间占用呈现报告所需的时间?

Thanks Ankit Vijay for your response, the answer has to be with the time out as you mention, my solution was the next one 感谢Ankit Vijay的回答,答案必须与您提到的超时有关,下一个是我的解决方案

I was using the jsreport embbedserver and i set the time out like this 我正在使用jsreport embbedserver,我将超时时间设置为这样

embeddedReportingServer.ReportingService.HttpClientTimeout = TimeSpan.FromMinutes(40);

With this line of code i stop recieving this error: TaskCanceledException: a task was cancelled while rendering jsreport 使用以下代码行,我不再收到此错误: TaskCanceledException:在渲染jsreport时取消了一个任务

Then when i was testing again i got this error with the phanton process: 然后,当我再次测试时,我在phanton进程中遇到了这个错误:

Unable to render template. 无法呈现模板。 Error during rendering report: Timeout when executing in phantom. 渲染报告期间出错:在幻像中执行时超时。

At the end i solved it by adding configuration to my embbed server like this 最后,我通过将配置添加到我的嵌入式服务器来解决了这个问题

Helper.embeddedReportingServer.Configuration = new
            {

                phantom = new
                {
                    timeout = 900000,
                    numberOfWorkers = 2
                },


                tasks = new
                {
                    numberOfWorkers = 2,
                    timeout = 900000,


                }

            };

The TaskCanceledException most likely should be coming due to timeout. TaskCanceledException最有可能是由于超时而出现。

Try increase timeout through jsreport configuration. 尝试通过jsreport配置增加超时时间。 You can read more about jsreport configuration here . 您可以在此处阅读有关jsreport配置的更多信息。 I have not tried it myself but it should be tasks.timeout property. 我自己没有尝试过,但是应该是tasks.timeout属性。

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

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