Where can I set startTimeOut in .net or something similiar?
-
Cause it seems like my first render/request always fails and the others works perfectly fine. Similiar problem to this one https://groups.google.com/forum/#!topic/jsreport/mAbgQ_6I8lo
Whenever I make a first request to just builded project, first pdf render always first and throws exceptions like: "Error while copying content to a stream.", "Socket has been closed".
Where do I specify the start time out.
public PdfService() { _pdfJsreportCreator = new PdfJsreportCreator(); _reportingService = new LocalReporting() .UseBinary(JsReportBinary.GetBinary()) .Configure(cfg => { cfg.LicenseKey = ConfigurationManager.AppSettings[JS_REPORT_LICENSE]; return cfg; }) .AsWebServer() .Create(); }
This class is initialized in the api controlled constuctor.
What can I do to fix this proble.
-
Not sure that is the main problem, but...
_reportingService.StartAsync()
returns an async task which you need to await or use something like_reportingService.StartAsync().Wait()
.
-
Wops sorry, it actually has await but the StartAsync is called inside a method which is placed in som PdfCreator class.
public async Task<byte[]> CreatePdfReport(ILocalWebServerReportingService _reportingService, PdfTemplate template, IEnumerable<PdfPart> templateParts, IPdfStateObject stateObject) { await _reportingService.StartAsync(); var renderRequest = CreateRenderRequest(template, templateParts, stateObject); var report = await _reportingService.RenderAsync(renderRequest); return await GetPdf(report); }
-
So you call
StartAsync()
every time you want to render a report?
You should do it just once. During the application init for example.