Wrox Programmer Forums
|
BOOK: Professional C# 2008 ISBN: 978-0-470-19137-8
This is the forum to discuss the Wrox book Professional C# 2008 by Christian Nagel, Bill Evjen, Jay Glynn, Morgan Skinner, Karli Watson; ISBN: 9780470191378
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional C# 2008 ISBN: 978-0-470-19137-8 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 May 20th, 2010, 01:51 PM
Registered User
 
Join Date: May 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Post Chapter 23 - Windows Services

I'm attempting to use your examples when I go to implement the QuoteService Project.
In the Section titled "Service Start" I'm trying to add the code --> protected override void OnStart(string[] args)
{
QuoteServer quoteServer = new QuoteServer(@"c:\windows\system32\quotes.txt", 7890);
quoteServer.Start();
}

and then run it, I get the error "OnStart: cannot declare instance members in a static class."

Honestly, the code is getting hard to follow with respect to building this final part of the project. What would help is to get entire code for this specific chapter so I can eliminate guess work and follow something more logical then whats in the book.
Thank you,
WD
 
Old May 20th, 2010, 06:04 PM
Registered User
 
Join Date: May 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up

Figures I would eventually figure out the problem myself then waiting for the slow responsiveness in a typical Forum.

I failed to recognize that I needed to add the code within the Service1.cs (Service code file) or whatever you renamed it to. Once in there I found the auto-code "protected override void OnStart(string[] args)" and then added the code to that. i.e.
protected override void OnStart(string[] args)
{
QuoteServer quoteServer = new QuoteServer(@"c:\windows\system32\quotes.txt", 7890);
quoteServer.Start();
}

Wallace





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 23 - Building the Consumer phil-c- BOOK: Professional VB 2005 ISBN: 0-7645-7536-8 1 January 20th, 2009 11:52 AM
Chapter 1, Page 23 golden_drifter BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 7 July 9th, 2004 12:12 AM





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