Windows Services crashes when calling FastReport
Hey all,
i'm using the FastReport.NET library in a Windows Service. When I start my report generation, the service will crash.
I'm using resources for the reports (.frx Files) because I read that there are problems with the root/base directory when using windows services (c:\windows\system32 ...).
I get no usefull error message or stack trace. Only a popup will be displayed and the service will be stopped.
- DatabaseConnection1 is also used for other DB operations in the service, so this should be correct.
- Properties.Resources.MyReport is defined in the "resources" tab of the project - also tried this with a FormApplication project (no service) and it worked - so this should be also okay.
I found some topics in the forum:
https://www.fast-report.com/en/forum/index....showtopic=11596
https://www.fast-report.com/en/forum/index....?showtopic=6332
- Do I have to define the parameter ConnectionString in the report?
- What's the correct usage for the report files (.frx)? Resource? Filesystem?
Thank you guys!
Markus
i'm using the FastReport.NET library in a Windows Service. When I start my report generation, the service will crash.
using (Report reportBericht = new Report())
{
reportBericht.Load(new MemoryStream(Properties.Resources.MyReport));
reportBericht.SetParameterValue("ConnectionString", ConfigurationManager.ConnectionStrings["DatabaseConnection1"].ConnectionString);
reportBericht.SetParameterValue("id", _pdfReport.Id);
reportBericht.Prepare();
FastReport.Export.Pdf.PDFExport export = new FastReport.Export.Pdf.PDFExport();
MemoryStream stream = new MemoryStream();
reportBericht.Export(export, stream);
}
I'm using resources for the reports (.frx Files) because I read that there are problems with the root/base directory when using windows services (c:\windows\system32 ...).
I get no usefull error message or stack trace. Only a popup will be displayed and the service will be stopped.
- DatabaseConnection1 is also used for other DB operations in the service, so this should be correct.
- Properties.Resources.MyReport is defined in the "resources" tab of the project - also tried this with a FormApplication project (no service) and it worked - so this should be also okay.
I found some topics in the forum:
https://www.fast-report.com/en/forum/index....showtopic=11596
https://www.fast-report.com/en/forum/index....?showtopic=6332
- Do I have to define the parameter ConnectionString in the report?
- What's the correct usage for the report files (.frx)? Resource? Filesystem?
Thank you guys!
Markus
Comments
DatabaseConnection_xxx has to be set in the app.config