FileNotFoundException error rendering the template
-
I have downloaded and tried you .net example
Console.WriteLine("Rendering template"); var rs = new LocalReporting() .UseBinary(JsReportBinary.GetBinary()) .KillRunningJsReportProcesses() .Configure(cfg => cfg.FileSystemStore().BaseUrlAsWorkingDirectory()) .AsUtility() .Create(); var report = rs.RenderByNameAsync("myTemplate", null).Result; using (var fs = File.Create("test.pdf")) { report.Content.CopyTo(fs); }
and I have the next error "FileNotFoundException: Could not find file 'C:\Users\dsenoran\AppData\Local\Temp\jsreport\autocleanup\metaac2524b0-f501-487a-b759-6dabaaf28b9f'"
-
Hi could you try this example as it is?
https://github.com/jsreport/jsreport-dotnet-example-consoleapp/Does it fail as well? Can you try to pause the antivirus temporarily?
Does it help?
-
Yes, both are failing with the same error and I have paused the antivirus.
-
Thank you. Maybe something on your computer is clearing up the jsreport temp directory.
Could you try to change the temp location?
https://jsreport.net/learn/dotnet-local#temp-filesnew LocalReporting().TempDirectory("my temp path")
-
Thanks for your quick answer, I already do this but the error persist.
The "autocleanup" directory exists but the file "metaac2524b0-f501-487a-b759-6dabaaf28b9f' not.
-
Hi, this looks strange. I am trying to discover a situation when this could happen...
Could you try the following to help with problem isolation, please?
Take the jsreport binary fromjsreport\dotnet\binary-default-2.9.0.0\jsreport.exe
and copy it somewhere and run the following (where test.html as a file with a random text)jsreport.exe render --template.content=test.html --template.engine=handlebars --template.recipe=chrome-pdf --out=out.pdf --meta=out.meta
Does this produce properly the
out.meta
file?Also, it is worth it to try to update to the latest jsreport. Could you update
jsreport.Binary
nuget to 2.11?
Also the other jsreport nugets if there are available updates.
-
I have updated the nuget packages but I have the same error.
The command works after I have renamed the file nssm64.exe in "jsreport/compile/jsreport-2.11.0-SJu_2xpjD" folder to nssm.exe because before this I got an error due to it couldn't find this file.
The meta file has been generated with this data:{"reportName":"report","contentType":"application/pdf","fileExtension":"pdf","logs":[{"level":"info","message":"Starting rendering request 1 (user: null)","timestamp":1614091522107},{"level":"info","message":"Rendering anonymous template { recipe: chrome-pdf, engine: handlebars }","timestamp":1614091522109},{"level":"debug","message":"Data item not defined for this template.","timestamp":1614091522109},{"level":"debug","message":"Resources not defined for this template.","timestamp":1614091522109},{"level":"debug","message":"Base url not specified, skipping its injection.","timestamp":1614091522111},{"level":"debug","message":"Rendering engine handlebars using in-process strategy","timestamp":1614091522115},{"level":"debug","message":"Compiled template not found in the cache, compiling","timestamp":1614091522161},{"level":"debug","message":"Executing recipe chrome-pdf","timestamp":1614091522164},{"level":"debug","message":"Converting with chrome HeadlessChrome/79.0.3945.0 using dedicated-process strategy","timestamp":1614091522510},{"level":"debug","message":"Page request: GET (document) file:///C:/Users/dsenoran/AppData/Local/Temp/jsreport/autocleanup/c80e78a6-bbe4-4a0e-a854-34fd03e7ccc9-chrome-pdf.html","timestamp":1614091522947},{"level":"debug","message":"Page request finished: GET (document) file:///C:/Users/dsenoran/AppData/Local/Temp/jsreport/autocleanup/c80e78a6-bbe4-4a0e-a854-34fd03e7ccc9-chrome-pdf.html","timestamp":1614091522955},{"level":"debug","message":"Running chrome with params {"margin":{},"printBackground":true}","timestamp":1614091522990},{"level":"debug","message":"Skipping storing report.","timestamp":1614091523285},{"level":"info","message":"Rendering request 1 finished in 1178 ms","timestamp":1614091523285}]}
-
hm, and do you have x64 windows? jsreport won't run on x32, although I would expect a different exception.
-
Yes, i have x64 Windows
-
This is the error I get if I don't rename nssm64.exe to nssm.exe
jsreport.exe render --template.content=test.html --template.engine=handlebars --template.recipe=chrome-pdf --out=out.pdf --meta=out.meta
(node:30892) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, chmod 'C:\Users\dsenoran\AppData\Local\Temp\jsreport\compile\jsreport-2.9.0-SJEB3Pyev\nssm.exe'
(node:30892) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:30892) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code
-
This is strange. It looks like the content of your extracted jsreport binary is corrupted. See how it looks for me. There are both nssm.exe files.
Could you try to delete folder
C:\Users\dsenoran\AppData\Local\Temp\jsreport\
and start the project with jsreport.Binary@2.11.0 again?