RenderByNameAsync works locally but not on server
-
I have installed jsreport.Local to a .net core application to render some pdfs. I can't find any decent help on how the folder structure in jsreport/ should be so I played around a lot.
What I do is:var directory = Path.Combine(AppContext.BaseDirectory, "jsreport"); var rs = new LocalReporting(). RunInDirectory(directory). Configure(cfg => cfg.AllowLocalFilesAccess().FileSystemStore().BaseUrlAsWorkingDirectory()); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) rs.UseBinary(jsreport.Binary.JsReportBinary.GetBinary()); else rs.UseBinary(jsreport.Binary.Linux.JsReportBinary.GetBinary()); return rs.AsUtility().Create();
When I tried to render a simple inline template with RenderAsync it worked both on windows 10 locally, and in my linuc docker images.
But this
var report = await rs.RenderByNameAsync("RoutinesSubject", reportData);
fails with error:jsreport.Local.JsReportBinaryException
Error rendering report: rendering has finished with errors:Error during rendering report: Unable to find specified template or user doesnt have permissions to read it: TempateName
jsreport.Local.JsReportBinaryException: Error rendering report: rendering has finished with errors:Error during rendering report: Unable to find specified template or user doesnt have permissions to read it: RoutinesSubject
at jsreport.Local.Internal.LocalUtilityReportingService.<RenderAsync>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()Is there a way to debug it? jsreport exists on server with it's structure.
-
Did you verify that your templates are being copy pasted to the bin during vs build?
Is this only docker case or you are able to run it normally on local?
Could you try to use this to get some logs into the output in case you try it in console?var service = rs.AsWebServer().RedirectOutputToConsole().Create(); service.StartAsync().Wait();
-
Yes build did copied the templates. I could run it locally on my windows 10, but not on my linux box which I tried some hours ago.
If I start it as webserver, how do I render the template? Shouldn't I change the code?
-
The code for web server usage is the same.
Could you please share a sample repository or a dockerfile I can use to test your issues?
-
Ok so I think I figured out what was going on. I forgot to install to this particular docker image the libfontconfig. Running the code as web server produced the debug logs to understand what was going on. Shouldn't the same log be outputed somehow when ran as Localprovider?
thanks
-
Thank you for the info
Shouldn't the same log be outputed somehow when ran as Localprovider?
Yes it should - https://github.com/jsreport/jsreport-dotnet/issues/6