Component | Description |
Create a project | It is recommended to use one of the Advosol\DANSRV new project templates to create a new application project. To create a new custom project with a wizard, start Visual Studio, choose create new project and select the Advosol\DANSrv project template. The wizard creates a project with small sample code and file/identifier names as defined in the user dialog. It also creates unique GUIDs for the server. |
Item Configuration | The items supported by the server can be defined in the code of the customization module. Another way supported by the Professional Edition, is to use the ConfigBuilder Tool to interactively create an XML file with all the item configuration definitions. |
Server registration |
The wizard generated projects and the sample server projects register the server in the post build step. To register the server as a Windows service: To unregister the server, execute the UnregServer.exe utility in the project output directory in elevated administrator mode. This unregisters the server from COM and as a Windows Service. |
Testing the generic OPC Server | The wizard generated project is a functional OPC server. It can be compiled and accessed from OPC clients. For this to make sense it has to be created with sample code enabled. In this case the server creates a few items and increments some of these items periodically. Without sample code the server is functional but without items and therefore clients cannot do much else then checking the server status. |
Debugging the Customization |
To debug the server, it is started in debug mode in Visual Studio. Since the customization module is a DLL, the generic server exe has actually to be started. The wizards make the necessary project definitions. The customization method GetServerRegistryDef() is called at startup. |
Deployment |
The server EXE and the customization DLL need to be in the same directory and the RegServer.exe utility must be executed in this directory.
|
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 . |