Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
269 views
in Technique[技术] by (71.8m points)

c# - How to add dependencies to a windows service

How to add dependencies to a windows service in InstallShield? My winservice depend on the two following services, so they must run before the service starts:

  1. COMSysApp
  2. SENS

Note: I have used InstallShield project to install my service and not windows installer class so i could not use the way that mr. Jerry.Wang suggested in his article.

EDIT:

How to add a dependency to SEN Service in installshield?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you have dependencies on other services, the ServiceInstall table has the Dependencies column to describe this:

This column is a list of names of services or load ordering groups that the system must start before this service. Separate names in the list by Nulls. If the service has no dependencies, then specify Null or an empty string. Use the syntax [~] to insert a Null. Dependency on a group means that this service can run if at least one member of the group is running after an attempt to start all members of the group.

For example, to require that the system start service1 and service2, before starting the service listed in the ServiceInstall column, enter service1[~]service2[~][~] into the Dependencies column. The identifiers service1 and service2 must either occur in the primary key of the table or be the name of the service that is already installed.

You must prefix group names with + so that they can be distinguished from a service name. To require that the system start service1 and at least one member of the ordering group MyGroup before starting the service listed in the ServiceInstall column, enter service1[~]+MyGroup[~][~].

Here is what InstallShield has to say about their representation of that table:

Services Settings

Enter any service or load-ordering groups that this service requires. The system attempts to start the dependent service or at least one member of the load-ordering group before starting this service.

Separate multiple dependencies with a comma (,).

You must precede the name of each load-ordering group with the SC_GROUP_IDENTIFIER—which is typically the plus sign (+)—so that the Service Control Manager can distinguish it from a service.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...