Reputation: 3689
I have a problem in my OPC client application using OPC NET API 2.00
, so when I want to connect to ABB Freelance OPC Server, it throws an exception when calling Opc.Server.Connect(Opc.ConnectData)
method.
Exception:
Unable to cast COM object of type 'System.__ComObject' to interface type 'OpcRcw.Comn.IOPCServerList2'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{9DD0B56C-AD9E-43EE-8305-487F3188BF7A}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
May be Problem relates to IOPCServerList2
interface:
#region Assembly OpcRcw.Comn.dll, v1.10.2.0
// C:\Windows\assembly\GAC_MSIL\OpcRcw.Comn\1.10.2.0__9a40e993cbface53\OpcRcw.Comn.dll
#endregion
using System;
using System.Runtime.InteropServices;
namespace OpcRcw.Comn
{
[Guid("9DD0B56C-AD9E-43EE-8305-487F3188BF7A")]
[InterfaceType(1)]
public interface IOPCServerList2
{
void CLSIDFromProgID(string szProgId, out Guid clsid);
void EnumClassesOfCategories(int cImplemented, Guid[] rgcatidImpl, int cRequired, Guid[] rgcatidReq, out IOPCEnumGUID ppenumClsid);
void GetClassDetails(ref Guid clsid, out string ppszProgID, out string ppszUserType, out string ppszVerIndProgID);
}
}
Upvotes: 1
Views: 2229
Reputation: 2139
IOPCCServerList2 is part of the OPCEnum service, not part of the server itself.
If you are connecting from remote, your application is accessing the OPCEnum service that is running at the same computer as the server.
IOPCCServerList2 is the new version of IOPCCServerList and most probable is that the version of OPCEnum service that is installed with ABB Freelance is too old.
You can update the OPCEnum service by installing the latest OPC Core Components that is available from the OPC Foundation website.
Upvotes: 1
Reputation: 552
E_NOINTERFACE here is a generic COM error (not so useful to indicate the real problem).
Check:
On the client: "OPC Core components redistributable" and RCWs mergemodule installed?
On the client: firewall settings?
On the server: dcom settings for the abb opc server is correct?
Just looking in the source code of IOPCCServerList2, my IOPCServerList2 has different version than yours. My guess that you try to use the old merge modules/api designed for OPC DA 1.0 (which a very old and obsolate opc standards), most opc server expect OPC DA 2.0 client connections.
Here is mine:
#region Assembly OpcComRcw, Version=2.0.105.1, Culture=neutral, PublicKeyToken=9a40e993cbface53
// C:\WINDOWS\assembly\GAC_MSIL\OpcComRcw\2.0.105.1__9a40e993cbface53\OpcComRcw.dll
#endregion
using System;
using System.Runtime.InteropServices;
namespace OpcRcw.Comn
{
[Guid( "9DD0B56C-AD9E-43ee-8305-487F3188BF7A" )]
[InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
public interface IOPCServerList2
{
void CLSIDFromProgID( string szProgId, out Guid clsid );
void EnumClassesOfCategories( int cImplemented, Guid[ ] rgcatidImpl, int cRequired, Guid[ ] rgcatidReq, out IOPCEnumGUID ppenumClsid );
void GetClassDetails( ref Guid clsid, out string ppszProgID, out string ppszUserType, out string ppszVerIndProgID );
}
}
Upvotes: 0