.Net jsreport v2 - LocalWebServerReportingService not yet started. Call Start() first
-
After Updating jsreport.Local/Client/AspNetCore to the latest versions from v1, I am getting the following error when trying to download a report:
LocalWebServerReportingService not yet started. Call Start() first.
Stacktrace:
at jsreport.Local.Internal.LocalWebServerReportingService.EnsureStarted() at jsreport.Local.Internal.LocalWebServerReportingService.RenderAsync(String templateShortid, String jsonData, CancellationToken ct) at jsreport.AspNetCore.JsReportMVCService.RenderAsync(String templateShortid, String jsonData, CancellationToken ct)
Error at line:
await _jsReportMVCService.RenderAsync(model.Report.TemplateCode, jsonObject);
Startup.cs /ConfigureServices
var scfg = new Configuration() { }; var _reportingService = new LocalReporting() .UseBinary(JsReportBinary.GetBinary()) .RunInDirectory(Path.Combine(Directory.GetCurrentDirectory(), "jsreport")) .Configure(cfg => scfg .FileSystemStore() .BaseUrlAsWorkingDirectory() .AllowedLocalFilesAccess() ) .AsWebServer() .RedirectOutputToConsole() .Create(); services.AddJsReport(_reportingService); _reportingService.StartAsync();
Any pointers to what changed, or what am I doing wrong?
-
SOLUTION:
I found the issue before posting, but posting the question, so if anyone is having a similar issue can find it quickly.
I had In addition to the packages mentioned above, I also jsReport.Binary.Ph2 installed. I uninstalled that package, and installed the new jsReport.Binary package. This will start the jsReport studio.
In Addition the reports will need to be updated to use the chrome-pdf recipe to actually download the reports.
-
This worked for me in the Statup.cs file of a .Net Core web application:
var localWebServerReportingService = new LocalReporting() .UseBinary(JsReportBinary.GetBinary()) .RunInDirectory(Path.Combine(Directory.GetCurrentDirectory(), "jsreport")) .Configure(cfg => cfg .AllowedLocalFilesAccess() .FileSystemStore() .BaseUrlAsWorkingDirectory() ) .AsWebServer() .Create(); localWebServerReportingService.StartAsync(); services.AddJsReport(localWebServerReportingService);