dougconran

Hi,

I'm struggling (in fact can't) get MSMQ working between a Desktop and a PDA.

Desktop is running Windows XP Pro, PDA is running Windows Mobile 2003 with MSMQ 4 installed. I'm using Visual Studio 2005 (C#) to develop the apps.

I can get messaging working on both the PC and PDA but only PC --> PC and PDA --> PDA. I've tried everything I can think of and/or discover via Google to get PC --> PDA or PDA --> PC to work but, so far, nothing has been successful.

I've tried getting the PDA to send to a message queue on the PC and the reverse. I've tried using a pukka network connection and Activesync. I know that the connection is fine because I can ping each device and I've checked that ports 1801 and 3527 are open on my firewall.

I've followed all the instructions from here including setting MSMQ to binary on the PDA and confirmed that the Status is DISCONNECTED.

I've tried many combinations of Queue Path, generally along the lines of:

QPath = "FormatNameBig SmileIRECT=TCP:192.168.1.69\\Private$\\MyQueue;XACTONLY" (the IP address being either the PDA or PC). I've also tried using DIRECT=OS:<server name>\\Private$\MyQueue;XACTONLY

The error messages I get are either 'Cannot determine whether a queue with the specified format name exists' or
(on the PDA) 'An error message cannot be displayed because an optional resource assembly containing it cannot be found' (this in spite of loading the relevant System_SR_ENU.CAB file). This error occurs at the point that the app tries to send the message.

I'm stuck.

At the moment I have no idea how to proceed but suspect that it is probably something to do with the way that I specify the queue.

Ideally what I would like is for the PDA to send data to a queue on the PC - How do I do that

Any help would be gratefully received.

TIA

Doug


Re: .NET Compact Framework Problem trying to get MSMQ working between PC and PPC

Kuleen Mehta MSFT

Hi Doug,

I see that you're trying to send a transactional message (XACTONLY) from the WM device to desktop and vice versa. Can you first create a non-transactional queue on the Desktop and try sending a simple message to if from the Device using

FormatNameBig SmileIRECT=TCPBig Smileesktop_IP\Private$\Mysimplequeue

If this doesn't work please reconfirm that you have the binary protocol enabled.

If this works please refer to the following blog entry to confirm that you're following all the steps necessary for transactional messaging, if thats what you need.

Regards,

Kuleen






Re: .NET Compact Framework Problem trying to get MSMQ working between PC and PPC

dougconran

Thank you for your prompt reply.

I've tried everything that you suggest and still consistently get the 'An error message cannot be displayed because an optional resource assembly containing it cannot be found' (this in spite of the fact that I have twice re-installed System_SR_ENU.cab).

For clarification, I've done the following:-

1. Confirmed that I have a private, non-transactional, queue on the PC

2. Set the message queue path to "FormatNameBig SmileIRECT=TCP:\Private$\myqueue"

3. Re run msmqadm on the PDA to (re) set binary mode (I do't know how to check that it is binary).

4. Send the message using 'myQueue.Send(m,MessageQueueTransactionType.Single);' having first set up Message m.

5. Followed Mark Ihimoyan's instructions (as far as I can determine).

I've tried a number of variations of point 2 above:-

a. Using server IP address as the IP address on an Ethernet network (this IP I could ping from the PDA)

b. Using the server IP address (gleaned using vxutils) used for a USB Activesync connection (this IP I couldn't ping)

c. Using ...DIRECT=OS:<servername>... as displayed under Data Connections in the Server Explorer window of the PC app. I've verified (using Net Use) that the PDA is in the same workgroup domain as the PC.

I've run the program through debug and stepped through it at the point that I'm sending the message. As far as I can determine (no useful error message being displayed) the program fails at the Send line.

This is the code that I have:-

Code Snippet

string QPath = @"FormatName:DIRECT=TCP:192.168.1.64\Private$\myqueue";

private void button1_Click(object sender, EventArgs e)

{

Message m = new Message();

m.Label = "Test Msg";

m.Body = this.textBox1.Text;

try

{

MessageQueue myQueue = new MessageQueue(QPath);

myQueue.Send(m,MessageQueueTransactionType.Single); <== seems to fail here

myQueue.Close();

}

catch (MessageQueueException mqe)

{

MessageBox.Show(mqe.Message.ToString());

}

}

Any help would be appreciated as (a) it is driving me mad and (b) I really need to be able to get this working.

TIA

Doug





Re: .NET Compact Framework Problem trying to get MSMQ working between PC and PPC

Ilya Tumanov

You can't send message in transactional mode to none transactional queue so that simply must fail.

Try this instead:

myQueue.Send(m);

Also there's an error message for every error in MSMQ. Make sure to install CAB with messages to see them instead of a massage saying you donĄŻt have messages installed. See this for more info. Also there's always useful information in exception even if message is unavailable, e.g. stack trace. Make sure to post it next time in its entirety.

Another thing: it is important to enable binary protocol and set up MSMQ in exact order (e.g. in MarkĄŻs blog). If you not sure you followed that order I would suggest resetting the device and doing it again.

Another thing to try ¨C send messages from one desktop to another, itĄŻs good for verifying networking is set up properly.






Re: .NET Compact Framework Problem trying to get MSMQ working between PC and PPC

dougconran

SUCCESS!!! - many thanks. Taking out the 'MessageQueueTransactionType.Single' has fixed it.

Regarding the error messages, I've 3 times tried installing System_SR_ENU by following the instructions on the link that you gave me. I end up with a file in the \\Windows directory that is System.SR.ENU and is 24b long - this doesn't seem right to me. Is there anywhere else that I can get the file from other than the installed VS 2005 SDK directory

TIA

Doug





Re: .NET Compact Framework Problem trying to get MSMQ working between PC and PPC

Ilya Tumanov

Make sure to install SR CAB for NETCF V2. Note CAB file names are the same for NETCF V1 and NETCF V2, V2 can't use V1 messages. You can see the version you've installed in "Remove programs" applet on device.

The file you see is just removal information and that seems like a normal size for it. There are also few DLLs deployed which should be GAC'ed.






Re: .NET Compact Framework Problem trying to get MSMQ working between PC and PPC

dougconran

I've just tried removing System_SR_ENU and re-installing it from the

c:\Program Files\Microsoft.NET\SDK\CompactFramework\v2\WindowsCE\Diagnostics directory.

I've checked through 'Remove Programs' and can confirm that I have Microsoft .NET CF 2.0 ENU-String ... installed (along with Microsoft .NET CF 2.0).

Other versions of System_SR_ENU that I have on my PC are in directories:-

C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\CompactFramework\2.0\v1.0\WindowsCE\Diagnostics

and

C:\Program Files\Microsoft Visual Studio .NET 2003\CompactFramework\SDK\v1.0.5000\WindowsCE\Diagnostics

I have now tried all of these and still get the missing resource message.

Any ideas

Thanks for all of your help on this - it is much appreciated.

Doug





Re: .NET Compact Framework Problem trying to get MSMQ working between PC and PPC

dougconran

Not sure whether to keep this in the same thread or start a new one but, having got PDA --> PCworking, I'm now having problems with PC --> PDA.

The problem is compounded by the fact that I still cannot get error messages but, as far as I can tell it seems to be a problem of the Receive being able to find the queue (in spite of the fact that the Send can find it).

I read somewhere that it might be something to do with access rights (although I don't know why the Send would then work) and I've tried creating private queues using the Administrative Tools application in Windows XP Pro. It made no difference.

The code for the whole PDA app is below (it is pretty simple!)

Code Snippet

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using System.Messaging;

namespace TestMSMQ

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

string QPath = @"FormatName:DIRECT=TCP:192.168.55.100\Private$\myqueue";

private void menuItem1_Click(object sender, EventArgs e)

{

this.Close();

}

private void button1_Click(object sender, EventArgs e)

{

Message m = new Message();

m.Label = "Test Msg";

m.Body = this.textBox1.Text;

try

{

MessageQueue myQueue = new MessageQueue(QPath);

myQueue.Send(m);

myQueue.Close();

}

catch (MessageQueueException mqe)

{

MessageBox.Show(mqe.Message.ToString());

}

}

private void button2_Click(object sender, EventArgs e)

{

MessageQueue myQueue = new MessageQueue(QPath);

myQueue.Formatter = new XmlMessageFormatter(new Type[] { typeof(String) });

try

{

Message m = myQueue.Receive();

textBox2.Text += (string)m.Body + "\r\n";

}

catch (MessageQueueException mqe)

{

MessageBox.Show(mqe.Message.ToString());

}

finally

{

myQueue.Close();

}

}

}

}

Once again, any help would be much appreciated.

TIA

Doug





Re: .NET Compact Framework Problem trying to get MSMQ working between PC and PPC

Ilya Tumanov

You can't do a remote read on devices, that is not supported. That also makes little sense as it requires constant network connection. MSMQĄŻs primary benefit is what thereĄŻs no need to have network connection at all times, MSMQ would store the message for you and forward it as connection is available, you donĄŻt have to worry about connection been in and out.

You have to make desktop to send a message to the queue located on the device and do a local read. See this sample.






Re: .NET Compact Framework Problem trying to get MSMQ working between PC and PPC

dougconran

Thanks for the help and I've done what you suggest but still cannot get it working, and I'm severely hampered by not getting any error messages.

I've set up a queue on the Desktop as:

string PDAPath = @"FormatNameBig SmileIRECT=TCP:192.168.55.101\Private$\MyQueue";

I've set up a queue (which I know exists because it is listed in Visadm) as:

string QPath = @".\Private$\MyQueue";

I then do a send from the PC followed by a receive on the PDA but all I get is the non-descriptive error message on the PDA.

As I understand it, the sequence of events is as follows:-

1. Application puts message into local queue on PC

2. If PC (MSMQ) finds a connection to the PDA queue the message is transmitted to the PDA

3. Otherwise it just sits in the PC local queue

If it just sits there, how does it eventually get transmitted to the PDA, by the PC polling to see if the PDA is there or by the PDA checking the PC when it has a connection and, if the latter, how does it know what queue to check

Is there any way of being able to tell whether the message is still in the local queue or whether it has been transmitted and lost in the ether

I'm sure I'm lacking some basic understanding and that is what is frustrating me but it is being made a 1000 times worse by not being able to see any error messages - is there anything I can do to rectify that (other than just re-loading System_SR_ENU which doesn't do anything)

Like I say, I'm a bit frustrated at the moment but I do appreciate your help.

Many thanks

Doug

BTW - I looked at the example from the link but it seems to be PDA --> PC, I need the other way around.





Re: .NET Compact Framework Problem trying to get MSMQ working between PC and PPC

Ilya Tumanov

You don't even need to run anything on device at this point, desktop should be able to send the message and msmqadm.exe should show it in a queue. Error is probably just a time out as you're not getting any message because desktop can't deliver them for some reason (e.g. wrong IP or networking issues). You should be able to check outgoing queue on desktop and see if messages you sent to the device are hanging in that queue. If not use msmqadm.exe to check if messages are received by device. If they are then itĄŻs a good idea to get messages working to find out why exactly it fails. You can also run the very same binaries on another desktop, see if that works.

I'm not sure why you can't see error message, that seems to be a correct CAB and it should work fine assuming it was installed. See if you have SR DLLs in the GAC - check \window\GAC* files, should be version 2.0.0.0.

Actually sample goes both ways - PDA->desktop and then desktop->PDA.






Re: .NET Compact Framework Problem trying to get MSMQ working between PC and PPC

dougconran

GOT IT!!!

Many many thanks. I think that it was the IP address plus different spellings of the queue name (myqueue as opposed to MyQueue). Anyway, it is now working both ways.

The messages were sitting in the outgoing queue on the desktop, when I resent them using the different spelling and IP address (network as opposed to Activesync) it got through.

I still need to sort out the missing error messages.

I have some 26 GAC files of which 1 is GAC_System_v2_0_0_0_cneutral_1.dll

I also have a System.SR.Dll which is 331k and a System.SR.2.0.ENU.gac (57 bytes).

Noithing else.

I'll sort this out tomorrow.

Many thanks

Doug





Re: .NET Compact Framework Problem trying to get MSMQ working between PC and PPC

dougconran

OK - this is for anyone that comes afterwards.

1. I was having 2 problems:-

a. I could not send messages over a network between a Desktop and a PDA (using Net CF v2.0)

b. I was not getting error message text being displayed on the PDA

2. Solutions (thanks to Kuleen and Ilya Tumanov)

a. The principle is 'Send to a remote queue, Receive from a local queue' eg on the PDA I had:-

string RQ = @".\Private$\MyQueue"; // Receive messages into a local queue

string SQ = @"FormatNameBig SmileIRECT=TCP:192.168.1.64\Private$\myqueue"; // Send messages to a remote queue

(Question for the afore-mentioned gurus. If the server has to send to a remote client, how does it get the IP address where that IP address is allocated by DHCP )

b. Messages are non-transactional so do NOT have XACTONLY at the end (contrary to instructions elsewhere)

c. Make sure the PDA is set up for binary transfers (use msmqadm, not visadm).

d. Make sure that it is a proper Ethernet network, not an Activesync one. Although I could get the Activesync allocated IP addresses for both desktop and PDA I could not get it to work (but then, that might have been just me)

e. Probably best to make sure that both queues already exist (they do not have to have the same name).

3. Regarding error messages, I never did get to the bottom of that. I installed the correct version of System_SR_<Language>.cab (several times) but it had no effect. In the end I reverted to displaying the errorcode (which is reasonably meaningful) and then reading the associated text from here.

I hope this helps someone.

Doug





Re: .NET Compact Framework Problem trying to get MSMQ working between PC and PPC

Ilya Tumanov

Actually you probably misread "instructions elsewhere". XACTONLY and transactional mode are valid and _required_ if you're sending messages to remote transactional queue. That is, if remote queue is transactional (created as such) then you _have_ to use XACTONLY and transactional mode. If remote queue is not transactional then you _canĄŻt_ use them or messages would not be delivered. LetĄŻs recap:

Remote queue is NOT transactional: do NOT use XACTONLY and do NOT use transactional mode.

Remote queue IS transactional: DO use XACTONLY and DO use transactional mode.

Note delivery behavior is not affected by that, messages are delivered completely or not at all regardless of transactional mode. Transactional mode on MSMQ CE is basiclay some goo to support sending messages to remote transactional queues.

How server knows the IP of the device That is a good question. There are several answers:

- Server does not use IP, it uses name which is resolved to IP by appropriate networking services (DNS, WINS or even broadcast). That is recommended solution.

- Device uses static IP or DHCP server is configured to assign the same IP to particular device (e.g based on MAC).

- Device sends itĄŻs IP to the server via message as it changes. That has an issue what all messages sent to previous IPs would be lost.

As to your exception messages issue, it looks like SR assembly was not GAC'ed for some reason (or it would be renamed to GAC_*.dll). You can try reinstalling SR CAB and running "\windows\cgacutil.exe /refresh" to fix it. You can also try GAC'ing it manually. Normally that assembly should be GACĄŻed automatically as you run any NETCF application, not sure why it did not work for you. The only reasons I can think of are:

- NETCF was installed after SR CAB

- You never run any NETCF applications, e.g. your application was already running at a time of installation.






Re: .NET Compact Framework Problem trying to get MSMQ working between PC and PPC

dougconran

Your first 2 points are noted - thanks for the clarifications.

Regarding the SR assembly, I've tried re-installing and running cgacutil.exe but it has made no difference. At the end of the day it is not something to be overly concerned about (now) because the error codes are adequate and the device I'm using for development is only a stand-in until I get the main devices.

Thanks for your help.

Rgds

Doug