Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > BOOK: Professional C#, 2nd and 3rd Editions
|
BOOK: Professional C#, 2nd and 3rd Editions
This is the forum to discuss the Wrox book Professional C#, 3rd Edition by Simon Robinson, Christian Nagel, Karli Watson, Jay Glynn, Morgan Skinner, Bill Evjen; ISBN: 9780764557590
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional C#, 2nd and 3rd Editions section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 25th, 2004, 01:48 PM
Registered User
 
Join Date: Sep 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default WinServices - Chapter 32 Pro C# 3rd Edition

Hi all, I hope someone can shine some light on the problem I seem to be having. I have created QuoteService, QuoteClient, QuoteServer, & TestQuoteServer. I install the service just fine but when I go to start it it starts & stops immediately. I get a message box that states "The QuoteService service on Local Computer started and then stopped. Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts service.". Can somebody please explain to me how to get around this because I've tried everything and can't seem to get it to work. The problem seems to be with QuoteServer because if I take out the calls to QuoteServer in the OnStart method and have it just write to a file then when I start the service it stays running but the minute I uncomment the calls to QuoteServer the same thing happens. I've downloaded the code off of this site to compare to what I wrote and they're identical. So now I'm really baffled as to what the problem is. Can anyone please help?

Thanks In Advance,
ALR
 
Old November 7th, 2004, 03:02 PM
Registered User
 
Join Date: Nov 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to mateoc15
Default

I have had this same problem, although not with the same code. I created a service of my own from scratch to simply monitor the local hard drive for a file, and if it is found, perform an action.

Newbie, as far as your code, I know you may THINK you have identical code to the book, but have you actually compiled the code from the CD to make sure? I have smacked myself in the forehead a few times because I thought things were "identical" but I came to realize that one critical line or even just one CHARACTER was different. Just a suggestion.

However, some help on this from ANYONE, ANYWHERE would be greatly appreciated!

 
Old March 3rd, 2005, 05:15 PM
Registered User
 
Join Date: Mar 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

To Get rid of this problem, I tried using a timer control to have the program wait for timer_elapsed event. It Worked !!!

Use the following lines of code in your InitializeComponent() method

private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.ServiceName = "Reciever1";
this.timer1.Interval = 60000; //60 Secs
this.timer1.Elapsed += new System.Timers.ElapsedEventHandler(this.timer1_Elap sed);
((System.ComponentModel.ISupportInitialize)(this.t imer1)).EndInit();

}
The last line is very important.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginning JavaScript 3rd Edition r_1481 BOOK: Beginning JavaScript 3rd Ed. ISBN: 978-0-470-05151-1 0 November 2nd, 2007 02:24 PM
Commentary on XSLT 2.0 3rd Edition Doug Bell Wrox Book Feedback 1 December 6th, 2006 11:43 AM
Ch 6, Delegetes and Events, 3rd edition Obnox BOOK: Professional C#, 2nd and 3rd Editions 1 December 12th, 2005 08:45 AM
Linux programming 3rd edition msalihu BOOK Beginning Linux Programming, 3rd Edition 1 November 20th, 2005 12:05 PM
C# 3rd edition -chapter 25 fjgnena BOOK: Professional C#, 2nd and 3rd Editions 0 September 9th, 2004 03:47 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.