468,107 Members | 1,303 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,107 developers. It's quick & easy.

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 4161
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Eric Chong | last post: by
2 posts views Thread by Shazad | last post: by
2 posts views Thread by Mark | last post: by
5 posts views Thread by vinoth | last post: by
1 post views Thread by =?Utf-8?B?TWFyaw==?= | last post: by
1 post views Thread by Solo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.