How to customize the service under Windows? How to define service dependencies?

xiaoxiao2021-03-06  148

background:

With Oracle Form 6i development, the background database uses Oracle10G, Form Runtime, and 10GDB on the same Windows2000 machine, in order to facilitate customers, each customer is turned on, automatically start Oracle10G and this application directly into the system.

problem:

The first trial is to create a shortcut in Startup. However, I didn't expect the launch of Oracle10G to be too slow, so that Oracle Form Runtime starts to try to connect Oracle10G before oracle10g is started. Of course, this is impossible to succeed.

Solution:

Use Windows services to launch this form runtime.

I used INSTSRV and SRVANY in Windows Resource Kit. This can be easily searched on Google.

1. Copy srvany.exe to C: / WinNT / System32

2. Run the instsrv to register a custom service for srvany.exe, such as MySRV

C: / TMP / INSTSRV MYSRV C: /WINNT/SYSTEM32/srvany.exe

3. In Service, find the just registered service and modify its properties to interactively. This is important, otherwise, the Form Runtime application will not display the user interface. At the same time, set the service to "automatically start"

4. Open the registry, HKEY_LOCAL_MACHINE / SYSTEM / CURRENTCAL_MACHINE / SYSTEM / CURRENTCONTROLSET / SERVICES / MyService, under this button, add a key, name "parameters"

5. Create a reg_sz under the parameters key, named Application, value = <所 启 程序 程序 程序>, in my application, is Oracle's ifrun60.exe

6. Create a reg_sz under the Parameters key, named AppParameters, Value =

7. Create a reg_sz under the Parameters key, named AppDirectory, Value = In my environment, it is the directory where the Oracle Form is located.

8. Since the program needs to start after Oracle 10g startup, I use the service's dependencies to implement this function. In the HKEY_LOCAL_MACHINE / SYSTEM / CURRENTCAL_MACHINE / SYSTEM / CURRENTCAL_MACHINE / SYSTEM / IRVICE button, add a reg_multi_sz, named Dependonservice, Value = ORACleServiceorCl.

At this point, all settings have been completed. Restart the machine, Well, IT Works.

PS: It turns out that the method of "changing the Windows service boot order" is implemented, but it seems that Microsoft does not support custom service group, and I don't clearly add Oracle Service to existing Groups will not be problematic. So use Dependancy to achieve it.

转载请注明原文地址:https://www.9cbs.com/read-127207.html

New Post(0)