Search code examples
c#visual-studio-2010windows-servicessetup-deployment

Window service not returning any error and is stuck


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.


Solution

  • I just added:

    reportViewer1=new reportViewer1();
    

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