0

I created a windows service basically its just creates a report and then exports it to pdf and emails.

I ran the whole application in debug mode and it works perfectly fine.

Now i created an installer for the windows service which installs it and it is success full but the windows service gets stuck at this point..

string reportPath = Application.StartupPath;
EventLog.WriteEntry("REPORT PATH" + reportPath);
reportPath = reportPath + "\\Reports\\";
EventLog.WriteEntry("NEW REPORT PATH" + reportPath);  //THIS IS THE LAST OUTPUT ...
             try
                {


                         reportViewer1.Reset();
                         reportViewer1.ProcessingMode = ProcessingMode.Local;

                         EventLog.WriteEntry("GREPORTID= " + gReportID); // THIS POINT IS NEVER REACHED IN EVENT VIEWER....

So i cannot find out whats wrong with the code? as it works perfectly fine in debug mode. Now it wont get past this point and the service too gets stuck in starting mode. Also I run it automatically after installing.

UPDATE

To be exact this is line the it wont pass through:

  reportViewer1.Reset();

Also i run the setup as administrator so not sure how can i be missing permissions?

Any help is highly appretiated.

confusedMind
  • 2,573
  • 7
  • 33
  • 74
  • have you checked the security areas? is your creadentials for the windows service allowed to access the path? or the eventlogs? – hallie Jun 17 '13 at 05:04
  • @hallie i get the path its the lines after it... – confusedMind Jun 17 '13 at 05:04
  • where do you get your qReportID? – hallie Jun 17 '13 at 05:05
  • @hallie i connect to database, get the Dataset and get this from that all thats works well as i have EventLogger everywhere its this point after which i see no output, reportID is 1,2,3,4. – confusedMind Jun 17 '13 at 05:07
  • @confusedMind: probably, `reportViewer1` tries to display any window (e.g., it needs any printer installed, and your service account hasn't one). Try to set service logon credentials the same, as your interactive user credentials. – Dennis Jun 17 '13 at 05:09
  • its a windows service and it works the same way perfectly fine in debug mode but i do set it on "Environment.UserInteractive".Can you guide me the way ? – confusedMind Jun 17 '13 at 05:11
  • can you start the service? are you able to attach the debugger to the process? – hallie Jun 17 '13 at 05:11
  • i can start the service but this is the first time i am making one so i don't have that much idea of the ways to debug this. – confusedMind Jun 17 '13 at 05:12
  • If i set it to User on the permission on the installerprocess.. During install it asks for my a username and pass i enter mine which is administrator but it does not even install it. – confusedMind Jun 17 '13 at 05:30
  • Get rid of the try/catch so you'll get a diagnosable exception. Don't forget to write an event handler for AppDomain.UnhandledException. – Hans Passant Jun 17 '13 at 09:44
  • @HansPassant Ok done, but i dont know where to look for the output ? – confusedMind Jun 17 '13 at 12:47

1 Answers1

0

I just added:

reportViewer1=new reportViewer1();

And made it on the go instead of adding on the designer and it worked .

confusedMind
  • 2,573
  • 7
  • 33
  • 74