OPC Historian .NET Server Toolkit Reference
Development Steps
Send comments on this topic.
Server Development > Development Steps

Glossary Item Box

Component Description

Create a project

 

Copy the sample server directory with all files and subdirectories to the project directory and open the Visual Studio solution at the copied location.

Item Configuration

 

The sample server has a CSV data file for each item. The HDA browse methods search the subdirectories of the EXE directory for such files and present a corresponding branch / item tree structure.

Server Registration

 

Each server needs to have unique registration definitions (CLSID, AppID, ProdID). Change the sample server registration definitions, either in the HDANSrv.Net4.exe.config file or in the SeverAdapt.cs/vb program module.

Execute the RegServer.bat file register the server.
The server can be unregistered by executing the UnregServer.bat file.
On Windows Vista systems the registration has to be done in elevated mode. This is difficult with batch files. It may be necessary to create a shortcut to HDANSrv.Net4.exe and add the appropriate command line argument:

  • /RegServer      for the server execution as a background process
  • /Service           for the server execution as a Windows Service
  • /UnregServer   to unregister the server. The registry entries are deleted.
                           If registered as a service, the Windows service is removed.

The file name of the generic server (HDANSrv.Net4.exe) may be changed according the user preference. In this case also the name of the configuration file and the file names in the registration BAT files need to be adapted.

 

Deployment

 

The server EXE and the customization DLL need to be in the same directory and the RegServer.bat file must be executed in this directory.
To copy the server to another computer you need to:

  • copy Core Components MSI file from the HDANSrv installation subdirectory OPC and run it to install the OPC proxys and OPCEnum.EXE. This installs the OPC Foundation 32-bit Core Components.
    For 64-bit servers the folder X64 Core Components must be copied to the target machine and registered by executing the Register.bat file in this folder.
  • copy the HDANSrv.Net4.exe, HDAPluginNet4.dll, RegServer.BAT (RegServer.EXE) and necessary configuration files from the output directory of the VS project into the application directory
  • execute RegServer.BAT once to register the server. On Windows Vista use RegServer.EXE instead because the registration needs to execute in elevated mode.
  • depending on security settings you may need to modify the configuration using the DCOMCNFG utility

DCOM Configuration

 

If more than one user does access the server then it's advisable to assign a specific launching user for this server. This is done with DCOMCNFG. If this is not done then multiple instances of the server may run in different users. As long as only one user accesses the server at any given time then this is normally no problem. However if multiple user access concurrently then multiple instances of the server will be launched. For the client this makes no difference but the server's device communication may not work properly.
See chapter Using OPC via DCOM with XP SP2.pdf for DCOM configuration details.

 

Copyright ©2004-2019 Advosol Inc. All Rights Reserved.