I have a windows service, which uses quartz to generate reports.
I have set output action of rdlc file to content and copy always. The rdlc file is present in bin/debug folder. When i start windows service. I am getting an error cannot find file "c:\windows\system32\SWKS0057.rdlc". I guess system32 is the folder from which windows service is running. How can i make it to run from the folder where the exe file is present. I can code the path in my program. But i do not know how the production folder will look like.
using (MySqlDataAdapter da = new MySqlDataAdapter(cmd.CommandText, con)) { DataTable dt = new DataTable(); da.Fill(dt); ReportDataSource rds = new ReportDataSource("DSReportSWKS0057", dt); ReportViewer viewer = new ReportViewer(); viewer.ProcessingMode = ProcessingMode.Local; viewer.LocalReport.ReportPath = "SWKS0057.rdlc"; //below one works //viewer.LocalReport.ReportPath = @"D:\Shared\windowsservice\bin\Debug\SWKS0057.rdlc"; viewer.LocalReport.DataSources.Add(rds); byte[] bytes = viewer.LocalReport.Render("EXCELOPENXML", null, out mimeType, out encoding, out extension, out streamIds, out warnings); FileStream fs = new FileStream(path, FileMode.OpenOrCreate); byte[] data = new byte[fs.Length]; fs.Write(bytes, 0, bytes.Length); fs.Close(); }