使用不同用户的 Websphere MQ 7 C# XMS 连接

发布于 2024-12-03 04:38:49 字数 1288 浏览 2 评论 0原文

我一直在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

牵强ㄟ 2024-12-10 04:38:49

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文