473,385 Members | 1,824 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 4325
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.