Skip to content

Erorr when trying to connect to OPC DA SERVER on a different machine other than localhost #59

@sriki24

Description

@sriki24

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions