-
Notifications
You must be signed in to change notification settings - Fork 104
Description
I have a requirement where i need to connect to OPC DA server locally as well to some remote servers in a different PC.
The localhost is working fine where as if i provide the IP address of the machine where OPC DA server is running getting the exception
CoCreateInstanceEx: The RPC server is unavailable.
at TitaniumAS.Opc.Client.Interop.System.Com.CreateInstance(Guid clsid, String host, NetworkCredential credential)
at TitaniumAS.Opc.Client.Common.OpcServerEnumeratorAuto.CLSIDFromProgId(String progId, String host)
at TitaniumAS.Opc.Client.Da.OpcDaServer.<>c__DisplayClass7.b__4(String host, String progId)
at TitaniumAS.Opc.Client.Common.UrlParser.Parse[T](Uri opcServerUrl, Func3 withProgId, Func3 withCLSID)
at TitaniumAS.Opc.Client.Da.OpcDaServer.Connect()
at TestHostOPCServerConnection.Program.Main(String[] args) in
Below is the small code created to test connection with OPC DA server
[MTAThread]
static void Main(string[] args)
{
try
{
Bootstrap.Initialize();
string opcServerName = "XYZ_OpcDaServer.3";
string hostName = "10.140.1.2";
Uri url = UrlBuilder.Build(opcServerName, hostName);
OpcDaServer server = new OpcDaServer(url);
server.Connect(); ----> //exception thrown when try to connect
if(server.IsConnected)
{
//dosomething
}
}
}
Note: There is no problem if i give localhost where in if i give IP address of some machine where OPC DA server is running,problem getting connection.