How to insert a web link?
ServiceController checking status?
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What can I do?
• What to Read?
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Зарегистрируйся!

QAIX > .Net Development > ServiceController checking status? 10 May 2005 22:33:56

  Recent blog posts: 
  They have birthday today: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Moderators:

ServiceController checking status?

Blain T Timberlake 10 May 2005 22:33:56
 Using the system.ServiceProce­ss.ServiceController­ I'm getting some odd
values back.

Basically if I pull up a list of services on a remote machine, there are
several services that consistently report the wrong status back. Some
others however report correctly.

For instance.... I do:

If myService.Status <> ServiceControllerSt­atus.Running Then
Throw New Exception("SQL Service was not running")
End If


If I run that for the service "Server", which is running it throws an
exception.

If I run for "Alerter" it reports correctly that it is running.

Checking "Computer Browser" also throws an exception even though it too is
running.

Anyone know of any rhyme or reason for what is going on here? On the
remote machine I am a full administrator. Just using the Services MSC
console I can pull up the list of all the services on the remote machine
and view statuses and/or start and stop them just fine.

Any thoughts?
=Blain


This communication is for use by the intended recipient and contains
information that may be privileged, confidential or copyrighted under
applicable law. If you are not the intended recipient, you are hereby
formally notified that any use, copying or distribution of this e-mail,
in whole or in part, is strictly prohibited. Please notify the sender
by return e-mail and delete this e-mail from your system. Unless
explicitly and conspicuously designated as "E-Contract Intended",
this e-mail does not constitute a contract offer, a contract amendment,
or an acceptance of a contract offer. This e-mail does not constitute
a consent to the use of sender's contact information for direct marketing
purposes or for transfers of data to third parties.

Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean

http://www.DuPont.c­om/corp/email_discla­imer.html

===================­================
This list is hosted by DevelopMentor http://www.develop.­com
Some .NET courses you may be interested in:

Essential SQL Server 2005 "Yukon" for Developers
August 23 - 27, Los Angeles
http://www.develop.­com/courses/yukon

Essential .NET: building applications and components with C#
30 August - 3 September, in Los Angeles
http://www.develop.­com/courses/edotnet

View archives and manage your subscription(s) at http://discuss.deve­lop.com

Add comment
Guest 10 May 2005 22:33:56 permanent link ]
 Hello,
I, too, have run into some issues regarding the ServiceController.S­tatus not retrieving the appropriate information. I have devised a potential workaround that may allow temporary workarounds. ServiceController.W­aitForStatus() is much more accurate on determining the current status. I just specify a timeout on the wait method that is relatively short:
ServiceController sc = new ServiceController("­MyService","MyMachin­e");
try
{
sc.WaitForStatus(Se­rviceControllerStatu­s.Running, new TimeSpan(3));
//We know that the service is definitely running
}
catch(TimeoutExcept­ion tX)
{
//Either a real timeout, or the service is not running currently
}
The timeout may need some adjustment if the service to be controlled is on a remote machine, but its a possibility...
Elliott Edwards
http://www.hachisof­t.com
Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или УК РФ.


QAIX > .Net Development > ServiceController checking status? 10 May 2005 22:33:56

see also:
FW: CPAN Upload…
Inlining subrules
sub/method refs (was Re: auto…
пройди тесты:
see also:
((
Nyuu

  Copyright © 2001—2008 QAIX
Idea: Miсhael Monashev
Помощь и задать вопросы можно в сообществе support.qaix.com.
Сообщения об ошибках оставляем в сообществе bugs.qaix.com.
Предложения и комментарии пишем в сообществе suggest.qaix.com.
Информация для родителей.
Write us at:
If you would like to report an abuse of our service, such as a spam message, please .