How to Use MSMQ in .Net?

  • Thread starter Thread starter b5e
  • Start date Start date
B

b5e

Sample:
System.Messaging.MessageQueue mq = new
System.Messaging.MessageQueue(@"FormatName:DIRECT=OS:B\private$\hello");
mq.Send("hello");
string s = mq.Receive().Body.ToString();//error,why?
MessageBox.Show(s);

Two PC A,B installed MSMQ
1.A want to send message to B,suppose B already has private queue
"hello",send is success,but receive is not correct,why?How to Receive
message from B in matchine A?
2.If A hasn't installed MSMQ.How to send message to B from A,and Receive
message from B?
 
you cannot access private queues from other machines. you will need to use a
public queue.

you may try using a webservice to push the data from one machine to another,
otherwise if you want to use msmq, it must be installed on both computers.

msdn contains a sample walkthru for msmq for private and public queues
please have a look
 
Now I can send and receive message from remote matchine.My sample is
correct.Error is my install MSMQ under domain.When I change domain to
WorkGroup then it works.
But another question is:
I Must install MSMQ in local matchine,otherwise it doesn't work.
Must I install MSMQ in my local matchine.

Alvin Bruney said:
you cannot access private queues from other machines. you will need to use a
public queue.

you may try using a webservice to push the data from one machine to another,
otherwise if you want to use msmq, it must be installed on both computers.

msdn contains a sample walkthru for msmq for private and public queues
please have a look

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
b5e said:
Sample:
System.Messaging.MessageQueue mq = new
System.Messaging.MessageQueue(@"FormatName:DIRECT=OS:B\private$\hello");
mq.Send("hello");
string s = mq.Receive().Body.ToString();//error,why?
MessageBox.Show(s);

Two PC A,B installed MSMQ
1.A want to send message to B,suppose B already has private queue
"hello",send is success,but receive is not correct,why?How to Receive
message from B in matchine A?
2.If A hasn't installed MSMQ.How to send message to B from A,and Receive
message from B?
 
of course you need to install msmq in every client machine
windows 2000 and above system already have msmq component.

it is a background service which provide distribute transaction
and can let your app work offline.
mq.Send("hello");
this line of code will submit the message to the local service
then to the service on remote machine.

is doesn't like a direct/realtime link like TCP et.
Now I can send and receive message from remote matchine.My sample is
correct.Error is my install MSMQ under domain.When I change domain to
WorkGroup then it works.
But another question is:
I Must install MSMQ in local matchine,otherwise it doesn't work.
Must I install MSMQ in my local matchine.

Alvin Bruney said:
you cannot access private queues from other machines. you will need to
use
a
public queue.

you may try using a webservice to push the data from one machine to another,
otherwise if you want to use msmq, it must be installed on both computers.

msdn contains a sample walkthru for msmq for private and public queues
please have a look

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
b5e said:
Sample:
System.Messaging.MessageQueue mq = new
System.Messaging.MessageQueue(@"FormatName:DIRECT=OS:B\private$\hello");
mq.Send("hello");
string s = mq.Receive().Body.ToString();//error,why?
MessageBox.Show(s);

Two PC A,B installed MSMQ
1.A want to send message to B,suppose B already has private queue
"hello",send is success,but receive is not correct,why?How to Receive
message from B in matchine A?
2.If A hasn't installed MSMQ.How to send message to B from A,and Receive
message from B?
 
Thanks Johnny Hu.

I always think MSMQ is direct send to remote matchine.
But I Want to know when remote machine is offline.
The message will be send correctly.
Where the message is?
How I can find it.

beauli

Johnny Hu said:
of course you need to install msmq in every client machine
windows 2000 and above system already have msmq component.

it is a background service which provide distribute transaction
and can let your app work offline.
mq.Send("hello");
this line of code will submit the message to the local service
then to the service on remote machine.

is doesn't like a direct/realtime link like TCP et.
Now I can send and receive message from remote matchine.My sample is
correct.Error is my install MSMQ under domain.When I change domain to
WorkGroup then it works.
But another question is:
I Must install MSMQ in local matchine,otherwise it doesn't work.
Must I install MSMQ in my local matchine.

Alvin Bruney said:
you cannot access private queues from other machines. you will need to
use
a
public queue.

you may try using a webservice to push the data from one machine to another,
otherwise if you want to use msmq, it must be installed on both computers.

msdn contains a sample walkthru for msmq for private and public queues
please have a look

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Sample:
System.Messaging.MessageQueue mq = new
System.Messaging.MessageQueue(@"FormatName:DIRECT=OS:B\private$\hello");
mq.Send("hello");
string s = mq.Receive().Body.ToString();//error,why?
MessageBox.Show(s);

Two PC A,B installed MSMQ
1.A want to send message to B,suppose B already has private queue
"hello",send is success,but receive is not correct,why?How to Receive
message from B in matchine A?
2.If A hasn't installed MSMQ.How to send message to B from A,and Receive
message from B?
 
oh, i haven't tried the offline mode.
but i know the message is stored somrewhere in \windows\ folder in a xml
format (win2k3)
I always think MSMQ is direct send to remote matchine.
But I Want to know when remote machine is offline.
The message will be send correctly.
Where the message is?
How I can find it.

beauli
of course you need to install msmq in every client machine
windows 2000 and above system already have msmq component.

it is a background service which provide distribute transaction
and can let your app work offline.
mq.Send("hello");
this line of code will submit the message to the local service
then to the service on remote machine.

is doesn't like a direct/realtime link like TCP et.
Now I can send and receive message from remote matchine.My sample is
correct.Error is my install MSMQ under domain.When I change domain to
WorkGroup then it works.
But another question is:
I Must install MSMQ in local matchine,otherwise it doesn't work.
Must I install MSMQ in my local matchine.

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote
you cannot access private queues from other machines. you will need
to
use
a
public queue.

you may try using a webservice to push the data from one machine to
another,
otherwise if you want to use msmq, it must be installed on both computers.

msdn contains a sample walkthru for msmq for private and public queues
please have a look

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Sample:
System.Messaging.MessageQueue mq = new
System.Messaging.MessageQueue(@"FormatName:DIRECT=OS:B\private$\hello");
mq.Send("hello");
string s = mq.Receive().Body.ToString();//error,why?
MessageBox.Show(s);

Two PC A,B installed MSMQ
1.A want to send message to B,suppose B already has private queue
"hello",send is success,but receive is not correct,why?How to Receive
message from B in matchine A?
2.If A hasn't installed MSMQ.How to send message to B from A,and Receive
message from B?
 
Back
Top