Exception when rendering report in windows service

Stimulsoft Reports.NET discussion
Post Reply
Chengkun
Posts: 5
Joined: Thu Nov 14, 2013 2:18 am

Exception when rendering report in windows service

Post by Chengkun »

I am trying to create a windows service to export report to pdf files.(StiReport version 2013.2)
This service will create a thread for each export request. inside the thread, we can open report, manipulate data source. But when we call StiReport.Render(false), it throws exception with the following call stacks.

The exact code runs fine in a console application. Can you share some light on this one? I suspect that might has something to do with the privilege of the thread's user, but why would Render() method accessing file/folder?

Thanks.

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.SetCurrentDirectory(String path)
at Stimulsoft.Report.StiReport.Compile(String path, Stream stream, StiOutputType outputType, Boolean autoCreate, Object standaloneReportType)
at Stimulsoft.Report.StiReport.Compile(String path, Stream stream, StiOutputType outputType, Boolean autoCreate)
at Stimulsoft.Report.StiReport.Compile(String path, StiOutputType outputType, Boolean autoCreate)
at Stimulsoft.Report.StiReport.Compile(String path, StiOutputType outputType)
at Stimulsoft.Report.StiReport.Compile(StiOutputType outputType)
at Stimulsoft.Report.StiReport.Compile()
at Stimulsoft.Report.Engine.StiReportV2Builder.RenderSingleReport(StiReport masterReport, StiRenderState renderState)
at Stimulsoft.Report.StiReport.RenderReport(StiRenderState renderState)
at Stimulsoft.Report.StiReport.Render(StiRenderState renderState, StiGuiMode guiMode)
at Stimulsoft.Report.StiReport.Render(StiRenderState renderState)
at Stimulsoft.Report.StiReport.Render(Boolean showProgress, Int32 fromPage, Int32 toPage)
at Stimulsoft.Report.StiReport.Render(Boolean showProgress)
at Bass.Ap21.StimulReport.StimulReport.ExportReport(String filePath) in c:\work\2014.1\CSharp\Applications\TaskScheduler\ClassLibrary1\StimulReport.cs:line 91
at Tasks.StimulReportTask.ExecuteInternal() in c:\work\2014.1\CSharp\Applications\TaskScheduler\Tasks\StimulReportTask.cs:line 68
at Bass.Ap21.Tasks.Task.<Bass.Ap21.Tasks.ITaskControl.Execute>b__0() in c:\work\2014.1\CSharp\Applications\TaskScheduler\Task\Task.cs:line 143
Chengkun
Posts: 5
Joined: Thu Nov 14, 2013 2:18 am

Re: Exception when rendering report in windows service

Post by Chengkun »

I think this is a problem on my end. When I created separate app domain for each thread, I did not set domain application base correctly. Once I set the application base to my assembly's directory, render and export works fine.

Thanks.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Exception when rendering report in windows service

Post by Alex K. »

Hello,

Let us know if you need any additional help.
Post Reply