如何使用 web.config 为 .net Web 应用程序指定 WebSphere MQ 通道表位置

发布于 2024-10-11 13:18:46 字数 1696 浏览 9 评论 0原文

我现在已经在这个问题上兜圈子了一段时间了。我正在尝试使用提供的通道表文件连接到分布式队列管理器。如果我在服务器上指定环境变量 MQCHLLIB 和 MQCHLTAB,我就可以让它工作。然而,IBM 文档指出 .net 配置文件可以覆盖这些变量。

以下是我在 web.config 文件中放置的内容:

...
<configSections>
   <section name="CHANNELS" type="System.Configuration.NameValueSectionHandler" />
</configSections>

<CHANNELS>
   <add key="ChannelDefinitionDirectory" value="C:\temp"></add>
   <add key="ChannelDefinitionFile" value="DSM_MOM_TEST.tab"></add>
</CHANNELS>
...

以下是正在执行的代码:

Hashtable properties = new Hashtable();
//Add managed connection type to parameters.
const String connectionType = MQC.TRANSPORT_MQSERIES_CLIENT;
properties.Add(MQC.TRANSPORT_PROPERTY, connectionType);
return new MQQueueManager(queueManagerName, properties);

queueManagerName 设置为通用队列管理器“*Q101T”。

但是,这不起作用,并且返回错误:2058 MQRC_Q_MGR_NAME_ERROR

除了环境变量之外,我无法找到有关如何使其工作的更多文档,并且标准 mqclient.ini 应由通道节覆盖在 web.config 中。

代码中是否有我遗漏的内容?任何提示将不胜感激。

编辑:我已将连接类型更改为 MQC.TRANSPORT_MQSERIES_MANAGED,并且我已经克服了遇到的错误。但是我现在收到返回的 I/O 错误:

System.IO.IOException 未处理 用户代码消息=“I/O 错误” 发生了。”来源=“amqmdnet”
堆栈跟踪: 在 IBM.WMQ.MQChannelTable.CreateChannelEntryLists(MQChannelListEntry 名单)

我认为这很可能与 https://www-304 有关.ibm.com/support/docview.wss?uid=swg1IC69174 所以我现在正在等待中间件人员确认是否是这种情况,并希望为我提供一个新的 .TAB 文件...

Edit2 看起来这不是问题。我运行了 MQ 跟踪,但它出错了,因为它找不到 AMQCLCHL.TAB 文件。我不明白为什么它还在寻找这个文件。它应该使用我的 web.config 中指定的通道表。有人知道为什么它不接受这些值吗?

I've been going around in circles for a while on this one now. I'm trying to connect to a distributed queue manager using a supplied channel table file. I can get this to work if I specify the environmental variable MQCHLLIB and MQCHLTAB on my server. However the IBM documentation states that the .net config file can override these variables.

Here is what I have placed in my web.config file:

...
<configSections>
   <section name="CHANNELS" type="System.Configuration.NameValueSectionHandler" />
</configSections>

<CHANNELS>
   <add key="ChannelDefinitionDirectory" value="C:\temp"></add>
   <add key="ChannelDefinitionFile" value="DSM_MOM_TEST.tab"></add>
</CHANNELS>
...

And here is the code that is executing:

Hashtable properties = new Hashtable();
//Add managed connection type to parameters.
const String connectionType = MQC.TRANSPORT_MQSERIES_CLIENT;
properties.Add(MQC.TRANSPORT_PROPERTY, connectionType);
return new MQQueueManager(queueManagerName, properties);

queueManagerName is set to the generic queue manager "*Q101T".

However this isn't working and I get an error returned: 2058 MQRC_Q_MGR_NAME_ERROR

I've been unable to find any more documentation on how to get this to work other than the environmental variables and the standard mqclient.ini should be overriden by the channels stanza in the web.config.

Is there something that I've missed in the code? Any tips would be greatly appreciated.

Edit: I've changed the connectionType to MQC.TRANSPORT_MQSERIES_MANAGED and I'm getting past the error I was getting. However I'm now getting an I/O error returned:

System.IO.IOException was unhandled by
user code Message="I/O error
occurred." Source="amqmdnet"
StackTrace:
at IBM.WMQ.MQChannelTable.CreateChannelEntryLists(MQChannelListEntry
nameList)

I think this is most likely related to https://www-304.ibm.com/support/docview.wss?uid=swg1IC69174 so I'm now waiting on the middleware guys to confirm if this is the case and hopefully provide me with a new .TAB file...

Edit2 Looks like this isn't the problem. I ran an MQ trace and it's erroring because it can't find the AMQCLCHL.TAB file. I don't understand why it's still looking for this file. It should be using the channel table specified in my web.config. Anyone know why it's not picking up these values?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

牵你的手,一向走下去 2024-10-18 13:18:46

.Net 配置文件仅用于托管客户端连接类型,因此切换到托管模式绝对是朝着正确方向迈出的一步。现在的问题是应用程序是否实际上在托管模式下运行。 定义要使用的连接类型信息中心部分。请注意,在某些情况下,托管连接可能会回退到非托管连接。我建议仔细阅读本节,看看这些情况是否适用。

或者,尝试在 mqclient.ini 文件中设置通道表。当不被 .Net 配置文件覆盖时使用该值。如果在此处设置值有效,则确认 .Net 配置文件中的值被忽略,可能是因为应用程序正在非托管模式下运行。

The .Net configuration file is only used for managed client connection types so switching to managed mode was definitely a step in the right direction. Now the question is whether the application is actually running in managed mode. There is a decision tree described in the Defining which connection type to use section of the Infocenter. Note that there are cases in which a managed connection can fall back to an unmanaged connection. I would suggest running through this section to see if any of these cases apply.

Alternatively, try setting the channel table in the mqclient.ini file. This value is used when not overridden by the .Net configuration file. If setting the value here works then it confirms that the values in the .Net configuration file are being ignored, presumably because the application is running in unmanaged mode.

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