473,809 Members | 2,718 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows Service Start Parameters

Al
Although it is not recommended to use the Start Parameters for a service, I
am wondering why i get an IndexOutOfRange error when i try to access the
args[] in the OnStart method. I place say, "Hello" in the field on the
services Start Parameters text box, and then write to the EventLog to make
sure that the value is being passed properly. Thoughts? Thanks.
Jan 9 '06 #1
2 4355
Hi,

"Al" <Al@discussions .microsoft.com> wrote in message
news:2C******** *************** ***********@mic rosoft.com...
Although it is not recommended to use the Start Parameters for a service,
I
am wondering why i get an IndexOutOfRange error when i try to access the
args[] in the OnStart method. I place say, "Hello" in the field on the
services Start Parameters text box, and then write to the EventLog to make
sure that the value is being passed properly. Thoughts? Thanks.


Did you check the Length property?

I have never ever used it, I do use the config file heavily though.
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Jan 9 '06 #2
Al
Yes. It is "0", which indicates that the start parameters are being ignored.
One odd thing I did notice is that after selecting "OK" for the service and
upon returning to the properties the value is missing. Like maybe it won't
even save the properties from that window. And yes I am using a config file
like yourself; the only thing is that there are multiple instance of SQL
running on the save server (DEV and QA) and there are different connection
strings for each. I want to say pass in "DEV" or "QA" on the start
parameters so that I can tell the service to pick a specific instance to run
against. I can manually edit the config file before I start the service, and
it works fine when a switch the dsns around. I just wanted to get away from
the editing and possible "fat finger" problems when I type. :)

Thanks.

"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

"Al" <Al@discussions .microsoft.com> wrote in message
news:2C******** *************** ***********@mic rosoft.com...
Although it is not recommended to use the Start Parameters for a service,
I
am wondering why i get an IndexOutOfRange error when i try to access the
args[] in the OnStart method. I place say, "Hello" in the field on the
services Start Parameters text box, and then write to the EventLog to make
sure that the value is being passed properly. Thoughts? Thanks.


Did you check the Length property?

I have never ever used it, I do use the config file heavily though.
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

Jan 9 '06 #3

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

Similar topics

5
7195
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
2
15233
by: Ken Lindner | last post by:
I have a need to become familiar with SQL Server 2000 for work. Needless to say I am new to SQL Server any version, but not IT in general. My employer has provided me with the SQL Server 2000 Personal disk from the SQL Server 2000 Enterprise kit as this is reported here on the MSDN web site to be the version that is supported on Windows XP. In fact so many of you kind people confess to having succeeded in doing it. I have tried...
2
3625
by: Shazad | last post by:
I am creating a windows service that requires parameters to start. The service Startup Type is set to automatic therefore it starts when the computer is started or rebooted. However the service fails because the parameters do not persist. If the service is started manually and the parameters entered it starts and runs correctly. If the computer is rebooted the service attempts to start but fails because the parameters are not used to...
2
21920
by: Mark | last post by:
I created an extremely simple windows service that only writes to the EventLogs on Stop and Pause. I installed it using the InstallUtil.exe program, the output of which is below. It appears to be successful. I'm now ready to start my service (I think) but the NET START command does not appear to indicate that the service is available to be run. The output for NET START is below as well. The Services list in the W2K administrator...
5
4281
by: vinoth | last post by:
Hi, I have created WindowsService Project.In that Project OnStart Method i have written the following Code. In this code the Server is waiting for the connection from client. When the Client connects to the Server, the server will process and send result to the client.(This is Client Server Application. The Server side Code is implementd in th OnStart method Of Windows Service). When i tried the Client Server Application in Console...
2
6904
by: deko | last post by:
When to use a privileged user thread rather than a windows service? That's the question raised in a previous post . It was suggested that if the service needs to interact with a WinForms app (which is the UI used to adjust the actions taken by, and the schedule of the service), then a privileged user thread should be used in the UI - no service required. But... "A windows service enables the creation of long-running executable
1
6416
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... After I installed my .net windows service, I tried to control some of the behavior with the Start Parameters: in the services control parameter. I can put a value in the box but for some reason it never gets saved (I open the properties right after, and the box is empty). How does one persist a value in the Start Parameters box for a service? Thanks
0
1581
by: iprogrammer | last post by:
i have a problem when i try to run my windows service ..which is "Error 1053: The service did not respond to the start or control request in a timely fashion" >after this i cannot anything with the service and have to restart the computer inorder for the service to be deleted. >1) my service program is basically a client tht is listening on a port to a request from a server and establishing a new connection. 2) reading and extracting...
0
30254
AmberJain
by: AmberJain | last post by:
Windows Autorun FAQs: List of autostart locations Linked from the Original article- "Windows Autorun FAQs: Description". Que: Can you list all the autostart locations for windows? Ans: Here is a comprehensive list of all autostart locations for Windows OSes: NOTE : These are some abbreviations used in this list. Please note them carefully: HKCU = HKEY_CURRENT_USER HKLM = HKEY_LOCAL_MACHINE
0
9721
marktang
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...
0
10639
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...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10383
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
10120
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...
0
6881
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();...
0
5550
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
5688
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3015
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.