jsreport resource folder location when running as utility

  • I've set up pdf generation according to the .Net local report example found at https://jsreport.net/learn/dotnet-local#locally-stored-templates. The console application is referenced by a web project and the jsreport resources are copied to the bin/jsreport folder as expected. I run jsreport as web server in the console application and as utility in the web application.

    The issue that I have is that every time a report is generated the files (reports, schedules, settings, tasks) in bin/jsreport/data/ folder are updated which causes the application domain to recycle.

    I've tried to move the jsreport folder outside the bin folder but couln't congfigure jsreport to find the new location.

    Is there any way to achieve this.

    Thanks in advance!

  • I see.

    Maybe you need to write your own logic that on the web start do the copy of bin/jsreport into app_data/jsreport.
    Then you configure jsreport to run in app_data/jsreport

    var rs = new LocalReporting()
                     .RunInDirectory(Path.Combine(Directory.GetCurrentDirectory(), "App_Data", "jsreport"))

    Would this work for you?

  • Thanks for your reply.

    I have tried to use the RunInDirectory() method but it makes no difference when creating the local reporting service AsUtility(). It does work when AsWebServer() is used.

    I've looked in to the jsreport.Local project and I can see that the directory field (_cwd) is not used when creating the local reporting service.

            public LocalWebReporting AsWebServer()
                return new LocalWebReporting(_binary, _cwd, _cfg);
            public LocalUtilityReporting AsUtility()
                return new LocalUtilityReporting(_binary, _cfg);

  • The mentioned path problem is now fixed in jsreport.Local 1.1.1

  • I've tried it out and it works just fine, thank you!

  • Great. What is your final solution now? Do you copy the jsreport folder back from bin to app_data?
    Is it just a simple recursive copy?

  • Actually, the way I have implemented it right now is that the console application acting as jsreport web server has it's working directory pointing to the app_data folder in the web application, and I have removed the reference to console application from the web application. This involves though a manual step in including the jsreport files in the web application project.

    This could be changed so that our release process copies the files to a configured common known location.

  • Ok. Thank you for sharing your solution.

Log in to reply

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.