Is there way to setup JsReport to use current application folder for storing temp files. Not using common folder C:\Windows\Temp\jsreport? If there are multiple applications running on common IIS, it produces Errors.
Error rendering report: A critical error occurred while trying to execute the render command: An error occurred while trying to start daemonized process: An error has occurred when trying to initialize jsreport (2). EBUSY: resource busy or locked, open 'C:\WINDOWS\TEMP\jsreport\compile\jsreport-2.2.0-r17qQMiI7\chrome\chrome.dll' (1). caused by error (2) -> stack = Error: at instance.init.then.catch ([eval]:43623:29) at tryCatcher (jsreportRuntime.js:146030:23) at Promise._settlePromiseFromHandler (jsreportRuntime.js:145723:31) at Promise._settlePromise (jsreportRuntime.js:145780:18) at Promise._settlePromise0 (jsreportRuntime.js:145825:10) at Promise._settlePromises (jsreportRuntime.js:145900:18) at Async._drainQueue (jsreportRuntime.js:41845:16) at Async._drainQueues (jsreportRuntime.js:41855:10) at Immediate.Async.drainQueues (jsreportRuntime.js:41729:14) at runCallback (timers.js:794:20) at tryOnImmediate (timers.js:752:5) at processImmediate [as _immediateCallback] (timers.js:729:5)caused by error (1) -> meta = {"errno":-4082,"code":"EBUSY","syscall":"open","path":"C:\WINDOWS\TEMP\jsreport\compile\jsreport-2.2.0-r17qQMiI7\chrome\chrome.dll"}, stack = Error: (1). caused by error (1) -> stack = Error: at exports.NsSocket.socket.dataOnce ([eval]:44008:13) at exports.NsSocket.listener ([eval]:16744:10) at exports.NsSocket.EventEmitter.emit ([eval]:16832:22) at exports.NsSocket._onData ([eval]:86359:8) at Lazy. ([eval]:51602:13) at Lazy. ([eval]:51584:19) at emitTwo (events.js:126:13) at Lazy.emit (events.js:214:7) at Lazy. ([eval]:51585:22) at emitOne (events.js:116:13) at Lazy.emit (events.js:211:7) at yieldTo ([eval]:51692:18) at Function. ([eval]:51730:27) at Lazy. ([eval]:51698:21) at emitOne (events.js:116:13) at Lazy.emit (events.js:211:7)
It needed to be configured in FilterConfig in RegisterGlobalFilters, so it creates jsreport folder in current app folder, so jsreport.exe do not interfere with other instances. Key property is TempDirectory, which define location for temporary folder. All files within this TempDirectory is created automatically.
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
var tempPath = Path.Combine(HttpRuntime.AppDomainAppPath, "jsreport");
filters.Add(new JsReportFilterAttribute(new LocalReporting()
.Configure(cfg =>
{
cfg.BaseUrlAsWorkingDirectory();
cfg.TempDirectory = tempPath;
return cfg;
})
.UseBinary(JsReportBinary.GetBinary())
.AsUtility()
.Create()));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With