(C#) ReportViewer in Windows Service

Viewed 412

we have a WPF project witch create some reports (22 exacly) using ReportViewer (2010), all those reports with more than 100 pages and really complex layout. Now we need a Windows Service to create those reports automatic everyday.

I Created the service, using the exaclty same logic, created the installer and build it, but, when I executed, the service only save 14 reports and it throws this exeception:

Win32Exception: Error creating window handle

Win32Exception: Error creating window handle

(My VS is in portuguese, here is the translation for you guys:)

I noticed that the use of RAM of the process goes up in a strage way, hitting the 570MB when the exception is called.

I Thought it could be some problem with the logic of creation of reports, so i created a Console Application Project to call the method and it works just fine.

My doubts are:

1) Is it possible have a limit of RAM use for a service, being necessary I clear the memory after every saved report? (if yes, how can I clear the memory? i inclued the call GC.Collec(); but unsuccessfully)

2) Is it possible that ReportViewer (a Windows.Form Component) enters in conflict with some stuff in Windows Services componenets causing the error?

Best Regards for everyone

1 Answers
Related