The XDASrv customization project creates a .NET assembly with the name NSPlugin.dll.
This DLL is called from the generic server and must therefore match the expected interface.
If the customization assembly is compiled with Visual Studio 2005 (for .NET Framework 2.0) then it must be used with the ASP.NET2 version of the generic server or the WCF version. The customization assembly may not be signed. The generic servers were compiled with an unsigned NSPlugin.dll and the .NET Framework will throw an exception if the assembly is signed.
Project Base:
A new XDASrv customization project can:
-
be created with the new project wizard
The wizard creates a new Visual Studio project with either skeleton code or sample code according the dialog selections.
-
be based on one of the sample applications
Copy the best fitted sample application into a new directory and make the following changes:-
open the copied project in Visual Studio and optionally change the solution and project name
-
open the file ServerAdapt.cs / .vb and change the server registration definitions in the method GetServerRegistryDef()
The XML DA server uses only the NameCurrServer and CompanyName definitions.
Unique GUIDs for the CLSID and APPID are only required if the plug-in is also to be used with the XDASrv OPC DA server. They can be generate with the Visual Studio tool Create GUIDS -
compile the project. The compiler output is NSPlugin.dll. This file must not be renamed and has to be in the web application bin subdirectory together with the generic server OpcXmlDaServer.dll
WCF web services need to be published into a directory that is defined as a web application -
Use the IIS Manager or MakeIISVDir.exe to define the project directory as an IIS web application. The copied sample application now runs under the new URL http://localhost/name/OpcXmlDaServer.asmx respectively http://localhost/name/OpcXmlDaServer.svc for a WCF service.
-
make the functional program changes
-
The project Assembly Name must always be NSPlugin and the output file NSPlugin.dll !
The minimally required files for an XDASrv web service are:
ASP.NET 2.0 | OpcXmlDaServer.asmx PrecompiledApp.config web.config bin\App_Code.dll (ASMX edition) bin\App_Code.compiled bin\NSPlugin.dll |
WCF web service | OpcXmlDaServer.svc PrecompiledApp.config web.config bin\App_Code.dll (WCF edition) bin\App_Code.compiled bin\NSPlugin.dll |
Self hosted WCF Service | Host application (see sample) App_Code.dll (WCF edition) NSPlugin.dll |
To debug the application the Visual Studio Debugger needs to be attached to the IIS worker process asp_net.exe respectively w3wp.exe in Vista.
Self hosted WCF services are debugged by adding the host application to the service project and starting the host application in debug mode.