Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fast Report export when Intraweb app running as a service
#1
Hi,
I'm using Delphi 10.2 (Tokio) and Intraweb 15.1.10. I have an application running in a Windows server as a Service, created with default parameters. Recently I've added a new report created with Fast Report 6.5 (last version). When I run the application on my development computer, or I run the app in SA mode, the report shows a preview, and when I export report to PDF, the file is created correctly and the PDF is shown in a new window in browser. But when I run the App as a Windows Service, the file is created empty, and an empty page is shown in browser.
I've changed the directory in which the file is created to C:\Temp, without success. I've changed also the user used to start the service, without success. Here is the source used to create the PDF file:
    RPTOF is the Fast Report Object
    frxPDFExport1  is the Fast Report Export to PDF Filter object.

    RutaInformeOrden     := 'C:\Temp\';
    NombreFicheroPDF    := ChangeFileExt(System.IOUtils.TPath.GetRandomFileName, '.pdf');
    NombreFicheroPDF    := RutaInformeOrden + NombreFicheroPDF;

    frxPDFExport1.FileName        := NombreFicheroPDF;
    frxPDFExport1.DefaultPath    := RutaInformeOrden;
    frxPDFExport1.OpenAfterExport := False;
    frxPDFExport1.ShowDialog      := False;
    RptOF.Export(frxPDFExport1);               <-- Here the file is created, empty when service, full as a SA
    // Open PDF in a new window
    URLFicheroPDF := TIWAppCache.AddFileToCache(Self, NombreFicheroPDF, TIWMimeTypes.GetAsString(mtPDF), ctOneTime);
    WebApplication.NewWindow(URLFicheroPDF);


Could you please help me with this problem?

KR,

                Venancio Lasquíbar
Reply
#2
Hi Venancio. Try this:
Code:
  NombreFicheroPDF := TIWAppCache.NewTempFileName( '.pdf' );

  frxPDFExport1.FileName := NombreFicheroPDF;
etc...
  RptOF.Export(frxPDFExport1);

   // Open PDF in a new window
  URLFicheroPDF := TIWAppCache.AddFileToCache(Self, NombreFicheroPDF, TIWMimeTypes.GetAsString(mtPDF), ctOneTime);
  WebApplication.NewWindow(URLFicheroPDF);
Reply
#3
Hi,

I first tried creating the file in AppCache, using the code you suggested. And don't works. I looked for the file created, and I didn't found it. Therefore I forced the cache directory, and this is the way in which I realized that the PDF is created empty when I run my application as a service, and not empty when running in SA mode.

Best regards,
Venancio Lasquíbar
Reply
#4
The only actual difference between the 2 types of application is the credentials of the user. Have you tested the service in your development machine using the same user as the logged in user? It is a simple test
Reply
#5
Hi Antoni,

I just installed the service in my dev computer, configured with my logon user as service start user, and the behaviour is the same: an empty PDF file.

Best regards,

Venancio Lasquibar
Reply
#6
Hi
Update.
Using same code, - and a different Delphi project, new ServerController and new UserSession, both with same content - I deployed application in a IIS server. If I place the .fr3 report file in a subdirectory of the root application directory (where the .DLL file is placed) and point the report directory to that subdirectory, the report is shown empty. However, if I place the report in same directory than the DLL and point the report directory to that subdirectory, the report works fine.
Subdirectory permissions are the default.
I would like to place my report in a subdirectory. Any idea?
Could this behaviour be a clue for my original problem?

Best regards,

Venancio Lasquíbar
Reply
#7
(01-08-2020, 10:37 PM)v.lasquibar@telefonica.net Wrote: Hi
Update.
Using same code, - and a different Delphi project, new ServerController and new UserSession, both with same content - I deployed application in a IIS server. If I place the .fr3 report file in a subdirectory of the root application directory (where the .DLL file is placed) and point the report directory to that subdirectory, the report is shown empty. However, if I place the report in same directory than the DLL and point the report directory to that subdirectory, the report works fine.
Subdirectory permissions are the default.
I would like to place my report in a subdirectory. Any idea?
Could this behaviour be a clue for my original problem?

Best regards,

              Venancio Lasquíbar

You need to look at the IIS permissions on the directory.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)