|
openSEAL Component Model: Business Application Service
Deploying a Business Application Service (BAS)
Depending on the operating system and desired preferences,
there are a number of ways you can host and deploy
a Business Application service.
-
You could use choose and configure
an openSEAL Application Service host implementation
(currently this is limited to a Win32 Service
implementation, but others, such as a Console
implementation, are coming soon). This removes
you from having to code the host - all you have
to do is edit a configuration file.
- You could "roll-your-own", either completely,
or by extending and implementing some of the base
classes we've already provided. This should be avoided
for all but the most custom requirements.
By far the easiest is to deploy and configure the openSEAL.win32.exe
assembly which allows you to install and run one or
more BAS as a Win32 Service (controlled via the SCM).
This is how the Reference Application is configured.
All you need to do is edit the <application.service.setup.win32>
section of the openSEAL.win32.exe.config
file to contain the setup information applicable to
your BAS.
See the reference application and the code documents
for more details.
A more involved approach would be to "roll-your-own"
deployment host.
Create your own Windows 32 Service (win32svc)
host for a BAS
Below is a step-by-step guide showing how to create
a Business Application Service (exe) host that
can run as a Windows 32 Service (henceforth denoted
a Win32Svc).
-
It is suggested that you copy
and modify the classes listed below from openseals
service\win32 folder. You'll
then be able to change a few things in the
code, such as their namespace, classnames,
the config section lookup key, and WinSvc
title and name information. Make sure to be
consistent between WinSvc name in your installer
file and in your projects build file.
Win32Installer.resx
-
Win32Installer.cs
-
Win32Main.resx
Win32Main.cs
RefappBusinessContainer.cs
- The files you copied above are
- Add
Win32AssemblyInfo.cs to the business\meta-inf
folder. You can create a new one using a text
editor or IDE, or just copy and modify the corresponding
file from openSEAL. Set your appropriate assembly
info, such as name and version number.
- If you use Nant to build, you'll need to add a
new task to build this assembly. The refapp has
a task commented out called build_bas_winsvc that
you can copy into your build file and edit as
appropriate. Once this is in place, test your
code compiles. In a command shell, cd to your
scripts/build folder and type: nant
build_bas_winsvc and check that the assembly
compiled and deployed correctly. You should see
the DLL under your projects bin folder.
- You now need to setup you exe's config file. It
is recommended that you copy the
openSEAL.win32.exe.config.dev|prod
config files from openSEAL to your projects config
folder, rename them, and edit their contents to
be applicable to your project.
- To install the WinSvc, in a command shell type
nant install_bas_winsvc . Check the
output to see if it installed correctly. If you
run into problems here, check that the WinSvc
names are consistent in {project}Win32Installer.cs
and {Project}Win32Main.cs , and that
the install util path in your NANT script is correct.
- To test the WinSvc by running it. To do this in
a command shell,type
nant start_bas_winsvc .
Check that there are the expected messages in
your event log and logfile. If the start didn't
work, you'll more than likely see 1 error message
and 1 info message in the event log. More often
than not, problems here are related to configuration
information, so check and double check your config
files. The error message in the event viewer should
give you pointers. If all is well and you are
using log4net too, you should see a log file created
in your log folder (defined in the config file).
|