Click here to Skip to main content
16,005,178 members
Home / Discussions / C#
   

C#

 
GeneralRe: how many characters is carriage return? Pin
Guffa30-Sep-08 8:24
Guffa30-Sep-08 8:24 
AnswerRe: how many characters is carriage return? Pin
leppie29-Sep-08 21:49
leppie29-Sep-08 21:49 
QuestionUsing C# and COM to connect to a Server Pin
SRogers8829-Sep-08 7:38
SRogers8829-Sep-08 7:38 
QuestionMessage Closed Pin
29-Sep-08 6:55
love_man00129-Sep-08 6:55 
AnswerADVERTISMENT! Pin
Dave Kreskowiak29-Sep-08 7:08
mveDave Kreskowiak29-Sep-08 7:08 
QuestionHow can I export a crystal report to an image object ? Pin
davebarkshire29-Sep-08 6:37
davebarkshire29-Sep-08 6:37 
AnswerRe: How can I export a crystal report to an image object ? Pin
Wendelius29-Sep-08 7:19
mentorWendelius29-Sep-08 7:19 
QuestionC# Windows Service - Issue Creating Multiple Services in 1 Project Pin
Brett G29-Sep-08 5:08
Brett G29-Sep-08 5:08 
Hello 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!
AnswerRe: C# Windows Service - Issue Creating Multiple Services in 1 Project Pin
Mark Salsbery29-Sep-08 8:51
Mark Salsbery29-Sep-08 8:51 
GeneralRe: C# Windows Service - Issue Creating Multiple Services in 1 Project Pin
Brett G29-Sep-08 9:00
Brett G29-Sep-08 9:00 
GeneralRe: C# Windows Service - Issue Creating Multiple Services in 1 Project Pin
Mark Salsbery29-Sep-08 9:05
Mark Salsbery29-Sep-08 9:05 
QuestionRead numbers from file Pin
hockymot2008_200929-Sep-08 5:04
hockymot2008_200929-Sep-08 5:04 
AnswerRe: Read numbers from file Pin
Simon P Stevens29-Sep-08 5:45
Simon P Stevens29-Sep-08 5:45 
GeneralRe: Read numbers from file Pin
Paul Conrad29-Sep-08 6:37
professionalPaul Conrad29-Sep-08 6:37 
AnswerRe: Read numbers from file Pin
User 665829-Sep-08 6:52
User 665829-Sep-08 6:52 
QuestionData sender and receiver Pin
ph1l229-Sep-08 4:55
ph1l229-Sep-08 4:55 
AnswerRe: Data sender and receiver Pin
led mike29-Sep-08 5:03
led mike29-Sep-08 5:03 
AnswerRe: Data sender and receiver Pin
Alan Balkany29-Sep-08 5:05
Alan Balkany29-Sep-08 5:05 
GeneralRe: Data sender and receiver Pin
led mike29-Sep-08 5:13
led mike29-Sep-08 5:13 
GeneralRe: Data sender and receiver Pin
Alan Balkany29-Sep-08 5:15
Alan Balkany29-Sep-08 5:15 
GeneralRe: Data sender and receiver Pin
ph1l229-Sep-08 10:54
ph1l229-Sep-08 10:54 
QuestionExport gridview content(including Images) into excel Pin
elango.sham29-Sep-08 4:46
elango.sham29-Sep-08 4:46 
QuestionPassing inherited class to WebService Pin
Member 82761329-Sep-08 3:51
Member 82761329-Sep-08 3:51 
AnswerRe: Passing inherited class to WebService Pin
Guffa29-Sep-08 5:55
Guffa29-Sep-08 5:55 
Questionmigrating one database to another Pin
postonoh29-Sep-08 3:43
postonoh29-Sep-08 3:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.