使用不同用户的 Websphere MQ 7 C# XMS 连接
我一直在使用 XMS API 连接到 Websphere MQ 并使用以下代码,我能够正常连接:
private IConnection CreateWqmConnection()
{
// Create the connection factories factory using WMQ (websphere message queue)
XMSFactoryFactory factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);
// Use the connection factories factory to create a connection factory
IConnectionFactory cf = factoryFactory.CreateConnectionFactory();
// Set the properties
cf.SetStringProperty(XMSC.USERID, @"user");
cf.SetStringProperty(XMSC.PASSWORD, @"password");
cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, MessageQueueManager);
cf.SetStringProperty(XMSC.WMQ_HOST_NAME, MessageQueueHost);
cf.SetIntProperty(XMSC.WMQ_PORT, MessageQueuePort);
cf.SetStringProperty(XMSC.WMQ_CHANNEL, MessageQueueChannel);
cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT);
cf.SetStringProperty(XMSC.CLIENT_ID, UniqueClientId);
return cf.CreateConnection();
}
但是,如果我尝试将用户名和密码更改为当前登录的用户以外的任何人,因为我收到2035 安全错误。我已登录到主机并将用户添加到 mqm 组,并且我可以使用 WMQ Explorer 使用此用户从本地计算机进行连接并发布消息,但不能使用 XMS。
另外,我发现如果我在这个用户帐户下调试程序,我可以连接,所以看起来我无法作为一个用户运行并以另一个用户身份进行身份验证。 XMS也是这样吗?有办法解决这个问题吗?
I have been using the XMS API to connect to Websphere MQ and using the following code I am able to connect fine:
private IConnection CreateWqmConnection()
{
// Create the connection factories factory using WMQ (websphere message queue)
XMSFactoryFactory factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);
// Use the connection factories factory to create a connection factory
IConnectionFactory cf = factoryFactory.CreateConnectionFactory();
// Set the properties
cf.SetStringProperty(XMSC.USERID, @"user");
cf.SetStringProperty(XMSC.PASSWORD, @"password");
cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, MessageQueueManager);
cf.SetStringProperty(XMSC.WMQ_HOST_NAME, MessageQueueHost);
cf.SetIntProperty(XMSC.WMQ_PORT, MessageQueuePort);
cf.SetStringProperty(XMSC.WMQ_CHANNEL, MessageQueueChannel);
cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT);
cf.SetStringProperty(XMSC.CLIENT_ID, UniqueClientId);
return cf.CreateConnection();
}
However if I try and change the username and password to anyone other than the user I am currently logged in as I am getting a 2035 security error. I have logged into the host machine and added the user to the mqm group and I can connect using this user from my local machine using WMQ Explorer and publish messages, just not with XMS.
Additionally I have found if I debug the program under this user account I can connect, so it appears I cannot run as one user and authenticate as another. Is this the case with XMS? And is there a way around this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
XMS 始终使用登录的用户 ID 与队列管理器进行身份验证。该行为类似于 WebSphere MQ C 客户端。请参阅此页面在信息中心中了解有关替代方案的更多详细信息。
XMS always uses the logged on user id for authenticating with queue manager. The behavior is similar to WebSphere MQ C Clients. Please refer to this page in the Infocenter for more details on alternatives.