opc服务器密码为空,为什么Opc.Ua.UserIdentity不能将密码干净地发送到OPC服务器?...

我有UserIdentity(用户,密码)构造函数的问题。 我的密码长度为4个字符。密码到达服务器时,长度为36个字符。前4个字符是我的密码 - 其余的是随机垃圾。为什么Opc.Ua.UserIdentity不能将密码干净地发送到OPC服务器?

Opc.Ua.Client.dll & Opc.Ua.Core.dll版本为1.0.238.1。

这是什么原因导致我该怎么做才能正确发送密码?

UPDATE

ApplicationConfiguration configuration = Helpers.CreateClientConfiguration();

X509Certificate2 clientCertificate = configuration.SecurityConfiguration.ApplicationCertificate.Find();

configuration.CertificateValidator.CertificateValidation += new CertificateValidationEventHandler(CertificateValidator_CertificateValidation);

EndpointDescription endpointDescription = Helpers.CreateEndpointDescription(Url);

EndpointConfiguration endpointConfiguration = EndpointConfiguration.Create(configuration);

endpointConfiguration.OperationTimeout = 300000;

endpointConfiguration.UseBinaryEncoding = true;

ConfiguredEndpoint endpoint = new ConfiguredEndpoint(null, endpointDescription, endpointConfiguration);

BindingFactory bindingFactory = BindingFactory.Create(configuration);

if (endpoint.UpdateBeforeConnect)

{

endpoint.UpdateFromServer(bindingFactory);

endpointDescription = endpoint.Description;

endpointConfiguration = endpoint.Configuration;

}

SessionChannel channel = SessionChannel.Create(

configuration,

endpointDescription,

endpointConfiguration,

bindingFactory,

clientCertificate,

null);

m_Session = new Session(channel, configuration, endpoint);

m_Session.ReturnDiagnostics = DiagnosticsMasks.All;

m_Session.KeepAlive += new KeepAliveEventHandler(Session_KeepAlive);

m_Session.Notification += new NotificationEventHandler(m_Session_Notification);

UserIdentity identity;

if (userName == null || userName.Length == 0)

{

identity = new UserIdentity();

}

else

{

identity = new UserIdentity(userName, password);

}

m_Session.Open("ATF UA client", identity);

log.Debug("Connect ok");

2013-03-07

paul

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值