Error: The CLSID for the internal OPCServer object is invalid. It must be in registry format
I am developing a .NET application. When I call.RegisterServer()on my SLIK-DA server, I get the following error:
The CLSID for the internal OPCServer object is invalid. It must be in registry format (i.e. {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx})
The reason this error occurs is because the string that has been passed into the SLIK-DA does not conform to the standard format of a GUID. The format is shown within the error statement.
When defining your OPC Server's GUID properties, you should define them as follows:
C#
server.CLSID = Guid.NewGuid().ToString( "B" );
server.AppID = Guid.NewGuid().ToString( "B" );
VB.NET
server.CLSID = Guid.NewGuid().ToString( "B" )
server.AppID = Guid.NewGuid().ToString( "B" )
The "
ToString()" method on the System.Guid object provides several formatting options. The option "B" outputs the GUID so that it includes the curly braces/brackets at the front/end of the GUID. Without this parameter, the GUID will be returned without the curly-braces which are ACTUALLY REQUIRED!