Error in MSMQ MessageQueue.Create

G

Guest

Hello All,

I am getting errors on the MessageQueue.Create statement of:

public static class CommonTools
{
// Since this is a private queue we follow the naming convention
// MachineName\Private$\QPath
// "." represents the local machine name
public const string QPath = @".\Private$\msmqdemo";
public static MessageQueue mesSendQ = null;
public static MessageQueue mesReceiveQ = null;

public static string CreateQueue()
{
try
{
mesSendQ = MessageQueue.Create(QPath); << Error occurs here
return "CreateQueue Successful";
}
catch(Exception ex)
{
return ex.Message;
}
}

This is the stacktrace that I get:

at
System.Messaging.Interop.SafeNativeMethods.MQPathNameToFormatName()\r\nat
System.Messaging.MessageQueue.ResolveFormatNameFromQueuePath()\r\nat
System.Messaging.MessageQueue.get_FormatName()\r\nat
System.Messaging.MessageQueue.SendInternal()\r\nat
System.Messaging.MessageQueue.Send()\r\nat
DemoMSMQ.Forms.testForm.buttonSend_Click()\r\nat
System.Windows.Forms.Control.OnClick()\r\nat
System.Windows.Forms.Button.OnClick()\r\nat
System.Windows.Forms.ButtonBase.WnProc()\r\nat
System.Windows.Forms.Control._InternalWnProc()\r\nat
Microsoft.AGL.Forms.EVL.EnterMainLoop()\r\nat
System.Windows.Forms.Application.Run()\r\nat
DemoMSMQ.Forms.Program.Main()\r\n

I tested this same code on the desktop and it worked fine. Is there a
problem with my queue path syntax for cf 2.0?

Thanks in advance for your help :)
 
I

Ilya Tumanov [MS]

This path should work.



By the way, your stack trace indicates exception happens in different place.
Also you forgot to include exception message.


--
Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
G

Guest

Hello Ilya,

Sorry I missed the exception. Here it is:

An error message cannot be displayed because an optional resource assembly
containing it cannot be found

Thanks in advance for your help :)

--
Bob Hanson
Senior Solutions Developer



Ilya Tumanov said:
This path should work.



By the way, your stack trace indicates exception happens in different place.
Also you forgot to include exception message.


--
Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
G

Guest

First push the System_SR_ENU assembly down so you can get a useful message.
Second, the stack trace indicates the error is in
System.Messaging.MessageQueue.Send() as a result of a
DemoMSMQ.Forms.testForm.buttonSend_Click(). The code doesn't match that at
all.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--





Bob Hanson said:
Hello Ilya,

Sorry I missed the exception. Here it is:

An error message cannot be displayed because an optional resource assembly
containing it cannot be found

Thanks in advance for your help :)

--
Bob Hanson
Senior Solutions Developer
 
G

Guest

Hello Chris,

Thanks for the reply. The form button being mentioned is what click event
started the CreateQueue:

private void buttonSend_Click(object sender, EventArgs e)
{
string Result = null;
Result = CommonTools.CreateQueue();
this.listBoxResult.Items.Add(Result);
Result = CommonTools.SendMessageToQueue();
this.listBoxResult.Items.Add(Result);
}

This is in a device winforms application.

You had mentioned the following:

"First push the System_SR_ENU assembly down so you can get a useful message"

Please excuse my ignorance on this as I am not sure what is meant.

I appreciate your help and please reply when you get a chance.

--
Bob Hanson
Senior Solutions Developer
 
G

Guest

Sorry again for my ignorance. I did google and found the cab file you had
mentioned. This is the new stack trace:

at System.Messaging.Interop.UnsafeNativeMethods.MQCreateQueue()\r\nat
System.Messaging.MessageQueue.Create()\r\nat
System.Messaging.MessageQueue.Create()\r\nat
DemoMSMQ.Common.CommonTools.CreateQueue()\r\nat
DemoMSMQ.Forms.testForm.buttonSend_Click()\r\nat
System.Windows.Forms.Control.OnClick()\r\nat
System.Windows.Forms.Button.OnClick()\r\nat
System.Windows.Forms.ButtonBase.WnProc()\r\nat
System.Windows.Forms.Control._InternalWnProc()\r\nat
Microsoft.AGL.Forms.EVL.EnterMainLoop()\r\nat
System.Windows.Forms.Application.Run()\r\nat DemoMSMQ.Forms.Program.Main()\r\n

I would like to mention as a side note that I built a matching testForm for
the desktop to test the CreateQueue and it worked without issue.

Thanks in advance for any insight you can provide :)
 
G

Guest

What is the exception message now?

-Chris


Bob Hanson said:
Sorry again for my ignorance. I did google and found the cab file you had
mentioned. This is the new stack trace:

at System.Messaging.Interop.UnsafeNativeMethods.MQCreateQueue()\r\nat
System.Messaging.MessageQueue.Create()\r\nat
System.Messaging.MessageQueue.Create()\r\nat
DemoMSMQ.Common.CommonTools.CreateQueue()\r\nat
DemoMSMQ.Forms.testForm.buttonSend_Click()\r\nat
System.Windows.Forms.Control.OnClick()\r\nat
System.Windows.Forms.Button.OnClick()\r\nat
System.Windows.Forms.ButtonBase.WnProc()\r\nat
System.Windows.Forms.Control._InternalWnProc()\r\nat
Microsoft.AGL.Forms.EVL.EnterMainLoop()\r\nat
System.Windows.Forms.Application.Run()\r\nat
DemoMSMQ.Forms.Program.Main()\r\n

I would like to mention as a side note that I built a matching testForm
for
the desktop to test the CreateQueue and it worked without issue.

Thanks in advance for any insight you can provide :)
 
G

Guest

Hello Chris,

I am still getting the following:

An error message cannot be displayed because an optional resource assembly
containing it cannot be found
 
G

Guest

Yes, I did install the System_SR_ENU.CAB file. The link and files you had
mentioned are for the Windows Mobile 5 and we are running the Win CE 5.0. The
other item I noticed on the link you had given me is this is for the VS 2005
Beta 2 and we are running the VS2005 VSTS released version. I did try to
install the msmq cab on the emulator and I received an error message "Not a
valid Windows CE setup file".

I did add the MSMQ component in Platform Builder for the emulator before
trying this test code.

Againg, thanks for your help :)
 
G

Guest

Hello Chris,

I do know that I added the component to the last build in Platform Builder
5.0.

I am sorry but I need to claim ignorance on how to start it on the Win CE
5.0 emulator. Your help is greatly appreciated.
 
G

Guest

Hello Chris,

This was more due to my lack of understnading in the Win CE 5.0 world.

The registry entries were missing to start the MSMQ process. Thanks for your
help and patience :)
 
G

Guest

If they are outright missing, I question whether MSMQ is in the build.
Adding the component to the build should put them in automatically - though
not always with the values you may desire.
 
G

Guest

I used set sysgen to verify that my build had MSMQ included. I had also added
Telnet and I needed to add reg settings for that to start up in PB 5 as well.

If there is something else I should be using to verify that a catalog item
was added to my build, please let me know.

Thanks again for your help :)
 
G

Guest

Check the release directory. First thing I'd look at it ce.bib to ensure
that everything is set up properly. I'd probably also look at what the UI
says the SYSGEN variable is for MSMQ and make sure it is in the ce.bib file
and that something lies in between that variable pair. If nothing is there,
then it wasn't set during the build process. If there are items, then you
know the binaries did get included in your build.

If the binaries were included, then go look in reginit.ini and do the same
thing - see if the sysgen veriable was set and the MSMQ settings got
included.

If that's all working, I'd do another makeimg and burn the image to flash,
verifying the write occurred properly and that the image running is indeed
the one built.

If that all worked, I'd then check the services from the command line and
see that MSMQ is available. I'd start it from there too.

Once that was all done, I'd then run a very simple test app that creates a
local queue and does TxRx.
 
G

Guest

Hello Chris,

Thanks for your reply.

I followed the steps that you had mentioned and everything was there. When I
tried the Services List from the command line, the MMQ1: was listed. When I
tried to start the Service using Services Start MMQ1: I still get the
Operation failed. Error Code 0x00000425.

I am running this on the V2 Arm Emulator CTP and when trying the telnet
service, I have no problem so I did verify a working network.

Thanks again for your help :)
 
G

Guest

Error 0x435 == 'The service cannot accept control messages at this time.'

Have you tried runnign the MQ Admin stuff? There's something weird going
on - like MSMQ is starting, but not fully up yet. I'm running out of ideas.
You've got all QFEs applied?
 
G

Guest

Hello CHris,

I did try the MSMQadm start command and I get unknown error.

I did post on the emulator forum to find our if there is an issue with doing
this on the Arm 4VI V2 CTP emulator.

Thanks for anything else you can think of :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top