ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » MQ client and .NET 4.0

Post new topic  Reply to topic Goto page 1, 2  Next
 MQ client and .NET 4.0 « View previous topic :: View next topic » 
Author Message
SrdjanNjiric
PostPosted: Mon Oct 04, 2010 11:27 pm    Post subject: MQ client and .NET 4.0 Reply with quote

Newbie

Joined: 04 Oct 2010
Posts: 6

Hi guys.

Client (ver. 2.0.0.3) in my case doesn't work in framework 4.0. I have done extensive testing with a sample program. The program was compiled for different frameworks and tested:

2.0 - works
3.0 - works
3.5 - works
4.0 - no

This is the sample program:

XMSFactoryFactory fact = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);

IConnectionFactory cf = fact.CreateConnectionFactory();
cf.SetStringProperty(XMSC.WMQ_HOST_NAME, "192.168.1.222");
cf.SetIntProperty(XMSC.WMQ_PORT, 1418);
cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, "MORH_LausQM");
cf.SetStringProperty(XMSC.USERID, "iloncar");
cf.SetStringProperty(XMSC.PASSWORD, "malimedo");
cf.SetStringProperty(XMSC.WMQ_CHANNEL, "SYSTEM.DEF.SVRCONN");
cf.SetIntProperty(XMSC.WMQ_QMGR_CCSID, XMSC.CCSID_UTF8);

IConnection conn = cf.CreateConnection("iloncar", "malimedo");

ISession session = conn.CreateSession(false, AcknowledgeMode.AutoAcknowledge);

IDestination queue = session.CreateQueue("laus.vendormanagement.out");

IMessageConsumer reader = session.CreateConsumer(queue);

conn.Start();

IMessage msg = reader.Receive(2000);

if (msg == null)
MessageBox.Show("No message.");
else
MessageBox.Show(msg.ToString());

MQ 7 itself is installed on CentOS and run with on VirtualBox. The exception is this:

CWSMQ0006E: An exception was received during the call to the method ConnectionFactory.CreateConnection: CompCode: 2, Reason: 2538
. During execution of the specified method an exception was thrown by another component. See the linked exception for more information.

Source: IBM.XMS.Client.WMQ
StackTrace: at IBM.XMS.Client.WMQ.WmqConnectionFactory.CreateProviderConnection(XmsPropertyContext connectionProps)
at IBM.XMS.Client.Impl.XmsConnectionFactoryImpl.CreateConnection(String userID, String password)
at MQ_test.Form1.button1_Click(Object sender, EventArgs e) in E:\Visual Studio 2005\Projects\MQ test\MQ test\Form1.cs:line 39

Linked exception (MQManagedClientException):

Message: 2538
Source: amqmdnet
StackTrace: at IBM.WMQ.Nmqi.ManagedNmqiMQ.NmqiConnect(String name, NmqiConnectOptions pNmqiConnectOpts, MQConnectOptions cno, Hconn parentHconn, Phconn pHconn, Int32& compCode, Int32& reason)
at IBM.XMS.Client.WMQ.WmqConnection..ctor(NmqiEnvironment nmqiEnv, NmqiMQ nmqiMQ, XmsPropertyContext connectProps)
at IBM.XMS.Client.WMQ.WmqConnectionFactory.CreateV7ProviderConnection(XmsPropertyContext connectionProps)

Any thoughts on this one??

Thanks in advance.
Back to top
View user's profile Send private message
vmcgloin
PostPosted: Tue Oct 05, 2010 1:14 am    Post subject: Reply with quote

Knight

Joined: 04 Apr 2002
Posts: 560
Location: Scotland

What have you done to determine why the host is not available - have you checked what the error message suggests? Any other clues in the error log?
Back to top
View user's profile Send private message
SrdjanNjiric
PostPosted: Tue Oct 05, 2010 1:22 am    Post subject: Reply with quote

Newbie

Joined: 04 Oct 2010
Posts: 6

vmcgloin wrote:
What have you done to determine why the host is not available - have you checked what the error message suggests? Any other clues in the error log?


I'm sure that message 2538 is false since all I need to do is change my target framework (which doesn't change code in any way) to something lower than 4.0 and the application is communicating with MQ smoothly. No other changes. Tested several times this morning and yesterday.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Oct 05, 2010 2:08 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Is framework version 4.0 officially supported by XMS?
Back to top
View user's profile Send private message
SrdjanNjiric
PostPosted: Tue Oct 05, 2010 2:13 am    Post subject: Reply with quote

Newbie

Joined: 04 Oct 2010
Posts: 6

mqjeff wrote:
Is framework version 4.0 officially supported by XMS?


This is from readme.txt:

2) Supported environments
-------------------------
XMS .NET is a fully managed .NET API which is built for applications to
run on the following platforms:

- Microsoft Windows XP
- Microsoft Windows Advanced Server 2003
- Microsoft Windows Vista
- Microsoft Windows 2008 Server

with
- Microsoft .NET Framework V2.0
- Microsoft .NET Framework V3.0
- Microsoft .NET Framework V3.5

The answer is no.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Oct 05, 2010 2:29 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

SrdjanNjiric wrote:
The answer is no.

That would explain why it doesn't work, then.
Back to top
View user's profile Send private message
SrdjanNjiric
PostPosted: Tue Oct 05, 2010 2:34 am    Post subject: Reply with quote

Newbie

Joined: 04 Oct 2010
Posts: 6

mqjeff wrote:
SrdjanNjiric wrote:
The answer is no.

That would explain why it doesn't work, then.


Informix and DB2 drivers work perfectly under 4.0 altough documentation doesn't make any such claims.

If I lower the target framework then I cannot reference any 4.0 assembly which is a show stopper. If I remain in a 4.0 framework I cannot connect to MQ?? I'm currently stuck between a hammer and a hard place.

I could really use a suggestion now?!
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Oct 05, 2010 2:45 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

If it's not listed as supported, it's because it either is known not to work or because it hasn't been tested yet.

If it is known not to work, then getting it to work requires code changes that simply haven't been made yet.

You may simply be stuck between a hammer and an anvil.

To attempt to move forward, you should make sure that all of your WMQ installs are at 7.0.1.3 (both the server and your build machine), and then open a PMR with XMS and see if you get any further assistance. You may not get anything more than "it won't work until the next release". But that's at least more information than you have today.
Back to top
View user's profile Send private message
shashikanth_in
PostPosted: Fri Oct 08, 2010 4:26 pm    Post subject: Reply with quote

Centurion

Joined: 26 Feb 2009
Posts: 123

Have you tried setting "UseLatestCLR" registry key to 1 in Windows Registry?
Back to top
View user's profile Send private message
shashikanth_in
PostPosted: Mon Oct 11, 2010 10:07 pm    Post subject: Reply with quote

Centurion

Joined: 26 Feb 2009
Posts: 123

I just got VS 2010 and wrote a XMS application using .NET 4.0 framework and XMS assembly created in 2.0 framework. It works just fine. Both application and queue manager are on my laptop.

This is what I used for my connection...
XMSFactoryFactory factoryFactory;
IConnectionFactory cf = null;

factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);
cf = factoryFactory.CreateConnectionFactory();
cf.SetStringProperty(XMSC.WMQ_HOST_NAME, "localhost");
cf.SetIntProperty(XMSC.WMQ_PORT, 6868);
cf.SetStringProperty(XMSC.WMQ_CHANNEL, "MQQM_CHANNEL");
cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT);
cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, "MQQM");
cf.SetIntProperty(XMSC.WMQ_QMGR_CCSID, XMSC.CCSID_UTF8);

IConnection connection = cf.CreateConnection("xxxxx","yyyyy");

This works fine. So not sure what's going wrong for you here. Is it because the application is running on Virtual Box
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Oct 12, 2010 12:47 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

shashikanth_in - you appear to be explicitly setting the connection mode and not specifying a user and password. This may be invoking a different behavior than SrdjanNjiric's code, which does not explicitly set connection mode and does try to set a user and password.

In particular, not setting the connection mode may be causing XMS to try a bindings connection or a managed connection under the covers.... but I get the sense you know that much much better than I do.
Back to top
View user's profile Send private message
shashikanth_in
PostPosted: Tue Oct 12, 2010 7:08 pm    Post subject: Reply with quote

Centurion

Joined: 26 Feb 2009
Posts: 123

MQJeff,

Yeah, not setting the connection mode, makes XMS take a different path. But I tried that too, commented out connection mode and works fine.

I expect a different reason code if the problem is with Userid or password.
Back to top
View user's profile Send private message
shashikanth_in
PostPosted: Tue Oct 26, 2010 11:16 pm    Post subject: Reply with quote

Centurion

Joined: 26 Feb 2009
Posts: 123

This problem is because of the change in behavior in .NET 4.0 Framework.

Ran some tests and here is what I found.

If an IP address that does not have a DNS entry is used in a call to Dns.GetHostEntry, the method returned the same IP address in pre .NET 4.0 framework. However this behavior has been changed in 4.0 where an exception is thrown.

Microsoft appears to saying the behavior change is as per design: https://connect.microsoft.com/VisualStudio/feedback/details/561083/dns-gethostentry-behaves-differently-in-net-4-0-than-previous-versions?ppud=0&wa=wsignin1.0
Back to top
View user's profile Send private message
SrdjanNjiric
PostPosted: Tue Sep 24, 2013 1:23 am    Post subject: Reply with quote

Newbie

Joined: 04 Oct 2010
Posts: 6

shashikanth_in wrote:
This problem is because of the change in behavior in .NET 4.0 Framework.

Ran some tests and here is what I found.

If an IP address that does not have a DNS entry is used in a call to Dns.GetHostEntry, the method returned the same IP address in pre .NET 4.0 framework. However this behavior has been changed in 4.0 where an exception is thrown.

Microsoft appears to saying the behavior change is as per design: https://connect.microsoft.com/VisualStudio/feedback/details/561083/dns-gethostentry-behaves-differently-in-net-4-0-than-previous-versions?ppud=0&wa=wsignin1.0


Wow. It's been three years...

Anyway, our solution remained on .NET 3.5 because of this issue but we can't delay the upgrade to 4.0 anymore. I have run several tests and I have encountered the same issues as before. The only new nugget of knowledge is that client somehow works on my dev. machine when built on .NET 4.0 framework but the same app fails on a production server. My machine is a Windows 7 while the server remained Windows 2003.

The MQ client version we use is 7.0.1.3.

I could use some suggestions here guys.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Tue Sep 24, 2013 3:30 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

SrdjanNjiric wrote:
the same app fails on a production server


Fails how ? What is the error message ?

If it works on A but not on B then B needs an environment adjustment.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » IBM MQ API Support » MQ client and .NET 4.0
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.