Hello
Is it possible to pass arguements to a .net service once it is in a
running state.
If this is not possible , are they alternative ways in which to achive
the same thing?
Glenn 2 2769
Hi,
You can use TCP/IP protocol, Remoting, Shared Memory, Named Pipes ...
... then service will have server part (that will listen for data/arguments
you send) ...
Easyest way is to use TCP/IP or remoting..
I'm using my IPC (interprocess communication) library for that things and
send data to service thru Named Pipes ...
You can find library at: http://www.habjansoftware.com/ipc_library.aspx ...
(it is commercial)
Regards,
Josip Habjan http://www.habjansoftware.com
"Glenn" <gl**********@b t.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. . Hello
Is it possible to pass arguements to a .net service once it is in a running state.
If this is not possible , are they alternative ways in which to achive the same thing?
Glenn
Glenn,
| Is it possible to pass arguements to a .net service once it is in a
| running state.
In addition to the other comments.
The "easiest" way to have a service accept a "command" to do something is to
override the ServiceBase.OnC ustomCommand method and have it call the same
procedure your Timer.Elapsed event handler calls.
Then you can use ServiceControll er.ExecuteComma nd to invoke this custom
command.
Note I would probably define an Enum of CustomCommands that my service
supported so its easier to keep track of them. A custom command for
OnCustomCommand is an integer between 128 & 256, which also means you can
have multiple custom commands defined.
Remember that ServiceControll er can control services on your local machine
as well as services on remote machines. Note you may need to configure the
various machines to allow remote control of services.
An alternative, more flexible method, which also entails more work, is to
enable your service for .NET Remoting. You could either make it a .NET
Remoting Server, in which case you call a method to have it perform some
action, or a .NET Remoting Client, and possible handle an "update data
event" on your server remoting object that says to update data...
Both of the custom commands & remoting with a service are discussed in
Matthew MacDonalds book "Microsoft Visual Basic .NET Programmer's Cookbook"
from MS Press.
As an alternative, depending on the nature of the arguments, I have written
them to the Service's app.config file, then stopped & restarted the service.
If your service only has a single service in it, stopping it causes it to be
unloaded from memory, restarting it should then cause it to re-read its
app.config. Of course if your service reads its config from the registry or
a different file, then you may not need to stop & restart it.
Hope this helps
Jay
"Glenn" <gl**********@b t.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
| Hello
|
| Is it possible to pass arguements to a .net service once it is in a
| running state.
|
| If this is not possible , are they alternative ways in which to achive
| the same thing?
|
| Glenn
| This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Eric Chong |
last post by:
I created a Windows Service in C# that requires to get
passed command arguments like a Console App. I noticed
that there is an option "Start parameters" text box in
the property of a Windows Service in MMC. Is there any
way to get arguments using this option? If possible, what
framework method should I use to get an arguement?
Thanks in advance.
Eric
|
by: Clinton Pierce |
last post by:
I've got a class that I want to access remotely. The touble is, I can't
figure out how to call the constructor of the class with arguments -- and
the arguments are necessary to initialize the class.
For example, here's my code on the client end:
static void Main(string args)
{
HttpChannel chan = new HttpChannel(0);
ChannelServices.RegisterChannel(chan);
|
by: amirmira |
last post by:
I would like to set command line arguments to a service at install time. I
need to do this because I need to get information from different registry
locations depending on my command line argument. I have to do it this way as
the consumer of the service should not be able to change the argument -
except by uninstalling and reinstalling the service.
I created the service and the service itself works great. However, when I
try to install...
|
by: James |
last post by:
I succesfully pass username , domain and password via this function (taken
from MSDN)
Private Declare Auto Function LogonUser Lib "advapi32.dll" (ByVal
lpszUsername As , _
ByVal lpszDomain As , ByVal lpszPassword As , _
ByVal dwLogonType As Integer, ByVal dwLogonProvider As Integer, _
|
by: ssg31415926 |
last post by:
I administer a Server 2003/XP network. A developer has come to me with
a proposal to put in a web service-based application. The workstations
will be XP and the servers 2003 but he can't use Integrated Windows
authentication with the logged-on account because some of the
workstations are shared and have a "department" account (with minimum
access*), so the user will be signing in to the application. They all
have Windows accounts which...
| |
by: bcastaing |
last post by:
My Windows service includes the following lines:
string Arguments3 = @"%OvAgentDir%\bin\OpC\cmds\ref-ovo-services.vbs
ServiceApplicatif ServiceOVO";
string expandedArguments3 =
Environment.ExpandEnvironmentVariables(Arguments3);
this.process3.StartInfo.Arguments = expandedArguments3;
this.process3.StartInfo.FileName = "cscript.exe";
ref-ovo-service.vbs runs with two arguments: ServiceApplicatif (windows
|
by: ojinfo |
last post by:
hi
i am currently working on a web service which is supposed to take a
xmldocument as input parameter, and then returns another xmldocument.
the service is added to the web references in my windows application,
and the call is executed. problem is that the input arguments gets
value nothing in the web service.
currently the code works as follows:
- create xmldocument 'input'
|
by: =?Utf-8?B?dmlzaHJ1dGg=?= |
last post by:
Hi,
I have 2 applications running, one Windows application project and the other
windows services project.
I want to call my Windows application in my windows services.
I want to run them as seperate process.
If my windows application starts running,only if it completes fully,
then my windows services should continue its execution.
My main process is Windows service.
|
by: =?Utf-8?B?dmlzaHJ1dGg=?= |
last post by:
Hi,
I have 2 applications running, one Windows application project and the other
windows services project.
I want to call my Windows application in my windows services.
I want to run them as seperate process.
If my windows application starts running,only if it completes fully,
then my windows services should continue its execution.
My main process is Windows service.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |