У меня возникла проблема при попытке подключиться к серверу DeltaV OPC .NET с удаленной машины. Однако соединение будет терпеть неудачу каждый раз, и я не мог понять, почему. Вот код, который я написал:Не удалось подключиться к серверу OPC .NET, когда IXiContext.GetXiEncode() используется для построения XiUserInfo
public XiUserInfo Credentials(string username, string password)
{
XiEncode rsaParamater = XiContext.GetXiEncode();
return new XiUserInfo(RSAparamater.Encode, username, password);
}
public static void CreateContext(XiUserInfo credentials)
{
ServiceEndpoint sep;
sep = iEndpointDiscovery.GetServiceEndpointsByBinding("IResourceManagement", typeof(NetTcpBinding)).First();
if (credentials != null)
{
iContext = XiContext.Initiate(sep, iEndpointDiscovery.ServerEntry,
300000, (uint)ContextOptions.EnableDataAccess,
(uint)System.Threading.Thread.CurrentThread.CurrentCulture.LCID,
Guid.NewGuid().ToString(), credentials);
}
}