12.04.2007, 16:10 | #1 |
Участник
|
axaptabuilder: How to setup Axapta batch server running as user defined windows service
Источник: http://axaptabuilder.blogspot.com/20...ch-server.html
============== Batch processing allows you to run a job, that requires a large amount of computer power, on another, faster computer. Batch jobs, once they are activated to run, are sent to a batch list, where they are queued, and will eventually be ran. This allows you to have jobs run without tying up your computer's power, meaning that you can continue to work while your job is being run. But, you should have in mind that it's not enough to schedule your job in Axapta using a Batch tab on the form. Even though your job will be put into a queue, it will not be executed until Axapta is started as a batch executer (processing instance). In order to have this kind of Axapta running you can simply start one more instance of Axapta client and go to Basic -> Periodic -> Batch -> Processing specify there batch group which this instance should take care of and that's basically it. But, having one more instance of Axapta running will make you a trouble when for example server was suddenly restarted. In order to start an Axapta client as a batch server instance you can specify special command line parameter using -startupcmd switch. It should look like this: -startupcmd=batch. The starting of batch using -startupcmd parameter involves these four classes: Application, SysStartupCmd, SysStartupCmdBatchRun and BatchRun In order to specify a batch group using the -startupcmd parameter use this kind of startup parameter: startupcmd=batch_invoice The thing is, that SysStartupCmd class takes any '_' sign as a separator for the startupCmd, treating batch_invoice as the command batch with invoice as the parameter. The Application class redirects control to SysStartupCmd when the -startupcmd parameter are specified. SysStartupCmd constructs a child class based on the command: SysStartupCmdBatchRun. The SysStartupCmdBatchRun class instantiates a BatchRun and calls run. Modifying infoRun as this: will get your batch server up and running with a specified batch group right from the command line! This seems to be it, but there is one more problem appears! How to make sure that this Axapta client (aka batch server) always starts when your server is started? Well, you can put it into your windows Startup menu, but then you have to make sure to login with your profile every time server starts! This is not appropriate solution for the server, so we will use standard windows services. To setup user defined windows server we will need to make some small modifications into the windows registry. Here are 6 easy steps to perform: 1. At a MS-DOS command prompt(running CMD.EXE), type the following command: [path]\INSTSRV.EXE [My Service] [path]\SRVANY.EXE where path is the drive and directory of the Windows NT Resource Kit (i.e., C:\RESKIT) and My Service is the name of the service you are creating. Example: C:\Program Files\Resource Kit\Instsrv.exe Notepad C:\Program Files\Resource Kit\Srvany.exe NOTE: To verify that the service was created correctly, check the registry to verify that the ImagePath value under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\service name is set to point to SRVANY.EXE. If this is not set correctly, the service will stop shortly after it starts and return an Event ID 7000 "The service name failed to start." NOTE: You should back up the registry before you edit it. 2. Run Registry Editor (Regedt32.exe)and locate the following subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ 3. From the Edit menu, click Add Key. Type the following and click OK: Key Name: Parameters Class : [leave blank] 4. Select the Parameters key. 5. From the Edit menu, click Add Value. Type the following and click OK: Value Name: Application Data Type : REG_SZ String : [path]\[application.ext] where [path]\[application.ext] is the drive and full path to the application executable including the extension (i.e., C:\WinNT\Notepad.exe) In our case you should type something like this: [path to your axapta client bin]\ax32.exe startupcmd=batch_yourBatchGroup 6. Close Registry Editor. By default, a newly created service it configured to run Automatically when the system is restarted. To change this setting to Manual, run the Services applet from Control Panel and change the Startup value to Manual. A service set to Manual can be started in one of several ways: - From the Services applet in Control Panel - From a MS-DOS command prompt, type the following: NET START [My Service] - Use the Sc.exe utility from the Resource Kit. Type the following from a MS-DOS command prompt: [path]\Sc.exe start [my service] where [path] is the drive and directory of the Windows NT Resource Kit (i.e., C:\Reskit). IMPORTANT: Before you edit the registry, make sure you understand how to restore it if a problem occurs. For information on how to do this, view the "Restoring the Registry" or the "Restoring a Registry Key" online Help topics in Registry Editor. ============== Источник: http://axaptabuilder.blogspot.com/20...ch-server.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|