472,805 Members | 871 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 software developers and data experts.

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 4302
Hi,

"Al" <Al@discussions.microsoft.com> wrote in message
news:2C**********************************@microsof t.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**********************************@microsof t.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
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...
2
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...
2
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...
2
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...
5
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...
2
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...
1
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...
0
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...
0
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.