Windows XP and Message Queue 4.0
-
Monday, March 19, 2012 3:55 PM
I have a question and hope that others have had this issue as well. We have several clients that are still on Windows XP which as you know uses Message Queuing 3.0. Our applications have moved to Framework 4.0 and operating systems are designed on Vista and Windows 7 machines now. So now Message Queuing is 4.0. Now the application won't work with our Windows XP clients. Is there a way to get this to work on XP without reverting everything back to the 2.0 framework? We have code that referencing 4.0 capabilities. I hope you can help me with this.
Thanks
Liz
- Moved by CoolDadTxMVP Thursday, March 22, 2012 2:38 AM MSMQ related (From:Visual C# General)
All Replies
-
Monday, March 19, 2012 4:27 PM
.NET v4 supports XP SP3+ so it isn't a .NET issue. I suspect your code is using features from MSMQ 4 that aren't supported in 3. Therefore you'll need to revert back to the featureset in MSMQ 3 if you want to support that version on XP.
Michael Taylor - 3/19/2012
http://msmvps.com/blogs/p3net
- Proposed As Answer by Neddy Ren Wednesday, March 21, 2012 6:23 AM
-
Monday, March 19, 2012 4:41 PM
This is all I am doing and this is what is failing. Error says: System.BadImageFormatException: "An attempt was made to load a program with an incorrect format." when trying to create the new message queue object.
string queuePath = ConfigurationManager.AppSettings["911-message-queue"];
try
{
_queue = new MessageQueue(queuePath);
_queue.PeekCompleted += queue_PeekCompleted;
_queue.BeginPeek();}
They supply the message queue name in the configuration file: computername\queuename.
- Edited by EWARE Monday, March 19, 2012 4:49 PM
-
Tuesday, March 20, 2012 2:24 AM
That means that you are trying to run an image that isn't compatible with the OS. This is generally seen when you try to run an x64 binary on an x86 OS (such as XP) or an x16 on an x64 OS (dos programs).
If you get this message when you start your app then verify that you are building an x86 application. If you are building an x64 application then you'll have to recompile to x86 in order to run under XP (or Vista/Win7 x86). XP technically has an x64 version but few people run it.
Michael Taylor - 3./19/2012
http://msmvps.com/blogs/p3net
- Proposed As Answer by Neddy Ren Wednesday, March 21, 2012 6:23 AM
-
Wednesday, March 21, 2012 11:18 PMOK, the application loads fine. It is when I try to access a message queue that the error occurs. If you look above, that is the little bit of code that is causing the error. However, the weird part is that it worked in a previous version. It is since our last release that it is causing this problem. Everything seems to be running under x86.
-
Thursday, March 22, 2012 2:38 AMI'm afraid I don't know enough about MSMQ to help you. However I'm confident the issue is in how you're accessing the queue and not a framework issue. I'm moving this thread to the MSMQ Forum so the experts there can better help you.
-
Thursday, March 22, 2012 4:14 PM
Doesn't seem to be an MSMQ functionality issue to me.
The error is "System.BadImageFormatException: "An attempt was made to load a program with an incorrect format"" which is not an MSMQ error.
If all you have done is change the .NET framework and not the code then there seems to be a mismatch in the .NET framework components used by your app.
Cheers
John Breakwell


