473,659 Members | 3,592 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ServiceProcess. ServiceControll er.Start on remote machine - why synchronous?

Hello,

I have the following code:

==========
Dim RemoteService As System.ServiceP rocess.ServiceC ontroller
RemoteService = New System.ServiceP rocess.ServiceC ontroller("serv ice1",
txtMachine.Text )
remoteservice.s tart
==========

If txtMachine is my local machine, remoteservice.s tart returns immediately,
as it should.

But if it's remote machine, it returns only when the service there enters
"Running" state.

Is this a bug or feature?
thanks,
Vadim Rapp

Nov 21 '05 #1
2 5882
I don't know if it's a bug or not but you can call it asynchonously
like this (check for typos):

'make a delegate to call our start sub
Private Delegate Sub StartDelegate()

'Elsewhere
Dim s As New System.ServiceP rocess.ServiceC ontroller
Dim sd As New StartDelegate(A ddressOf s.Start)
Dim AsyncResult As IAsyncResult
AsyncResult = sd.BeginInvoke( Nothing, Nothing)

'Code should return immediately
'Execute other code here if needed.

'To wait for the delegate to finish. This is not technically
needed if
'the method being called does not return a value, except maybe
for
'exception handling.

sd.EndInvoke(As yncResult)

Nov 21 '05 #2
Hello Chris,
You wrote in conference microsoft.publi c.dotnet.langua ges.vb on 5 Jul 2005
12:26:10 -0700:

CD> I don't know if it's a bug or not but you can call it asynchonously
CD> like this (check for typos):

CD> 'make a delegate to call our start sub
CD> Private Delegate Sub StartDelegate()

CD> 'Elsewhere
CD> Dim s As New System.ServiceP rocess.ServiceC ontroller
CD> Dim sd As New StartDelegate(A ddressOf s.Start)
CD> Dim AsyncResult As IAsyncResult
CD> AsyncResult = sd.BeginInvoke( Nothing, Nothing)

thanks, that worked!

Vadim

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5093
by: Gerhard Swart | last post by:
Hi all. I'm writing a queue browser that reads queues from a specified machine and then display the data that's on the queue. I am using the MessageQueue Class in .Net(C#). I get the problem that I can't read the journal private queue on a remote machine. I don't know if this is possible though. I have tried all the possible options but can't seem to get it to work. The code that I tried is: MessageQueue _mq = new MessageQueue(...
0
5029
by: Anthony Boudouvas | last post by:
Hi to all, i have made a module that can get a list of services running on a local or remote machine. So i have machine A that get a list of services of machine B The way the configuration is at the moment, is that in machine B, i have create a user account with the same credentials (username/password) that i was logged in machine A, so when i run the following
1
4077
by: Tom J | last post by:
What do I have to do to get System.ServiceProcess.ServiceController.ExecuteCommand(int) to work? I have written a service that overrides OnCustomCommand to handle commands sent to it. If I have application code like: ---------------------------------------------------------- ServiceController sc = new ServiceController("MyService");
16
4199
by: Serdar Kalaycý | last post by:
Hi everybody, My problem seems a bit clichè but I could not work around. Well I read lots of MSDN papers and discussions, but my problem is a bit different from them. When I tried to run the project in debug mode (by hitting F5) it gives an error message "Error while trying to run project: Unable to start debugging on the web server.
0
826
by: Scupper | last post by:
I'm trying to write an application that will periodically check a server for certain services and, if they are not running, attempt to start them. I'm using System.ServiceProcess and have no trouble detecting which services are up and which are stopped, regardless of what platform my application is running on. However, when I try to start services, success is very intermittent. As far as I can tell, running on XP or 2000 makes it...
1
2702
by: SenthilVel | last post by:
Hi We use System.ServiceProcess.ServiceController class is used to get the list of windows services installed in a particular machine. Also we use System.ServiceProcess.ServiceController.GetServices("IIS") to get the control on the IIS .. In the same way can we get the List of services which are part of the COM+ applications.
1
2009
by: Martin Arvidsson, Visual Systems AB | last post by:
Hi! I am using a ServiceController to start and stop my service. If i use the service localy and use the service controller it works fine. If i install the service on my server and try to connect to the service on that machine i get an access denied message. I am logged in as an Administrator on the client computer.
7
8619
by: =?Utf-8?B?YXVsZGg=?= | last post by:
hello, i'm try to research the way to open a remote machine's to collect the services and processes. i have the local data collection running but i can not figure out what MSDN or the C# help file is stating how to use "servicecollecter.machinename" to get the remote server's data. there is no samples on using framework to do this but loads of WMI. can someone share any sample / snippet on using framework with C# 2005 to get the...
3
2920
by: MedIt | last post by:
Hi all, I am trying to controll a service programatically using the ServiceController class .net c#. It is giving me an error that it cannot find the service name. I have tried it stopping with the command line using NET, and it works but not with my code! Can anyone please point me where I might be wrong? My code: string SERVICENAME = "TestService";
0
8337
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8531
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8628
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.