My eyes must be working well this morning, 3.64 first time
Brett G 0
Posts
-
Eyeball game -
C# Windows Service - Issue Creating Multiple Services in 1 ProjectJust realized that I only had one service installer set up. Added a second installer for the other service and things are running much better now. Thanks!
-
C# Windows Service - Issue Creating Multiple Services in 1 ProjectHello all: I am having a problem with a Windows Service that I'm writing in C# using Studio 2003. The main service will start fine, but for some reason the OnStart() and OnStop() methods in the additional service never fire on their own. As a workaround, in the second service I added a line to the InitializeComponent() method to call OnStart() since the Initialize method is actually called. This works as a workaround to get the service doing what it should, but then the OnStop() is never used and this seems a little odd to me. It does work this way, but I can't believe this is how it should be and I would like to have it running right. If you have any ideas, any help would be appreciated. Main Method in first service:
// The main entry point for the process
static void Main()
{
System.ServiceProcess.ServiceBase[] ServicesToRun;// More than one user Service may run within the same process. To add // another service to this process, change the following line to // create a second service object. For example, // // ServicesToRun = new System.ServiceProcess.ServiceBase\[\] {new Service1(), new MySecondUserService()}; // ServicesToRun = new System.ServiceProcess.ServiceBase\[\] { new MendsInterface(), new MendsToAllscripts()}; System.ServiceProcess.ServiceBase.Run(ServicesToRun); }
Initialize Method in the second service:
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.ServiceName = "MendsToAllscripts";\_common.LogMessage("Initializing Allscript service"); OnStart(null);
}
Thank you!
-
Who listens to music while they code?I listen to music most of the day. I started working from home a few months ago and was starting to get sick of regular radio so I decided to sign up for Sirius and now have that playing pretty much all day at home. Brett