Solved

ServiceController Modifiers?

Posted on 2006-06-24
4
215 Views
Last Modified: 2010-07-27
I recently discoved that using the code below in a win app is useless (always returns 'Stopped') if the serviceController modifiers are set to private, da......

         MessageBox.Show(serviceController1.Status.ToString());

I'm currently using 'Protected'.....................


Q. What is the correct modifer to use for maximum protection yet allow correct return status?


0
Comment
Question by:kvnsdr
  • 2
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16987095
If you are calling outside of the service, you need public scope.  What kind of protection are you looking for?

Bob
0
 
LVL 1

Author Comment

by:kvnsdr
ID: 16988086
The most without cutting off my nose.

I'm currently using 'Protected' and all works.

0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 125 total points
ID: 16988139
The scope modifier needed depends on where it is called from?  Is this called from inside the service instance?

1) 'private' is only visible inside a class
2) 'internal' is only visible within a class, and any other class in an assembly, but not outside.
3) 'protected' with 'static' are visible friend or member function of a derived class.
4) 'protected' without 'static' are visible to friends and inside in a derived class only through a pointer to, reference to, or object of the derived class.
5) 'public' is available everything

It sounds like 'protected' is the best you're gonna get.

Bob
0
 
LVL 1

Author Comment

by:kvnsdr
ID: 16989172
Thank you
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
compare between entities in entity framework 8 96
PrintingFoundIt(Almost!(Damn!)) 1 30
List<PaisEntity> - show some 1 28
VB.NET 2008 - SQL Timeout 9 34
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question