Hello,
I have a question about MSMQ as I'm new to using this system in the .NET framework.
Here is my following application that I run 2 instances of to test the ability to communicate through the MSMQ.
It's just a basic form with 2 textboxes, and 2 buttons, first textbox is to "send" or put on the queue (with a send button), second is to receive (take from the queue with a receive button).
My question is, why before I specified the message.Formatt er did it not allow the apps to take and put on the queue, before I added the formatter I was receiving an error of "Cannot find a formatter capable of reading this message" IF and only if you tried for the first time to remove the message from the other application, not if within the same instance of the application you send and received, that worked with no problem.
And even stranger, after each application sent and received within itself (meaning sent something to the queue and received it back, but not receiving something the other instance of the application put on the queue) they could then read what was put on the queue by the other application.
Shouldn't the formatter be default for both? Why should I have to declare it? -
-
namespace MSMQSender
-
{
-
public partial class Form1 : Form
-
{
-
private MessageQueue messageQueue1;
-
-
public Form1()
-
{
-
try
-
{
-
InitializeComponent();
-
-
string queuePath = "******\\private$\\test1";
-
-
if (MessageQueue.Exists(queuePath))
-
messageQueue1 = new MessageQueue(queuePath);
-
else
-
messageQueue1 = MessageQueue.Create(queuePath);
-
-
// messageQueue1.Purge();
-
messageQueue1.DenySharedReceive = false;
-
}
-
catch (Exception ex)
-
{
-
MessageBox.Show(ex.Message);
-
}
-
}
-
-
/// Send button
-
private void button1_Click(object sender, EventArgs e)
-
{
-
messageQueue1.Send(textBox1.Text);
-
}
-
-
/// Receive button
-
private void button2_Click(object sender, EventArgs e)
-
{
-
try
-
{
-
if (messageQueue1.Peek(TimeSpan.FromMilliseconds(100)) != null)
-
{
-
System.Messaging.Message message = messageQueue1.Receive();
-
-
string myMessage = ConvertToString(message.Body);
-
-
textBox2.Text = myMessage;
-
}
-
}
-
catch (Exception ex)
-
{
-
MessageBox.Show(ex.Message);
-
}
-
}
-
-
-
}
-
}
-
what fixed the issue was adding this: -
-
message.Formatter = new System.Messaging.XmlMessageFormatter(new string[] { "System.String" });
-
after the messageQueue1.R eceive(); statement.
0 2121 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Andrew Gordon |
last post by:
I'm investigating getting Microsoft Navision to do stuff from a Python
script. The recommended way seems to be to use message queues (MSMQ).
I can get Navision to send a message to itself fine. I found a couple
of code example in an ancient message in this newsgroup. The send.py
one I changed to the following:
from win32com.client import gencache
msmq = gencache.EnsureModule('{D7D6E071-DCCD-11D0-AA4B-0060970DEBAE}',
0, 1, 0)
qi =...
|
by: typingcat |
last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so
on. I've tried many PHP IDEs today, but almost non of them supported
Unicode (UTF-8) file.
I've found that the only Unicode support IDEs are DreamWeaver 8 and
Zend PHP Studio.
DreamWeaver provides full support for Unicode. However, DreamWeaver is
a web editor rather than a PHP IDE. It only supports basic IntelliSense
(or code completion) and doesn't have anything...
|
by: Ash |
last post by:
Hi,
I'm working on an application that takes csv files then converts it to XML.
It then write the XML to a msmq where another service is reading the queue
and sends it to the DB.
My question is:
My application flies (when using the Message object to wrap my data in a
non-transactional Q.
When using MessageQueueTransaction in a transactional Q the memory usage (in
task manager) keeps getting larger (as if GC never cleans up)
|
by: Webbee |
last post by:
I have a service built that is trying to read messages from a private que.
When this tries to happen I get this error....
A workgroup installation computer does not support the operation
From what I read I need to have my system setup on a domain, is this
correct? For my dev work I'm not going to have that envirorment available and
everything is tested on one laptop. Is there anything I can do? Thank you
|
by: Ted |
last post by:
I managed to get it installed OK, along side MS Visual Studio 2005
(with which I received it). During the install, I made sure I
installed everything.
I have developed a number of applications using MySQL v 5 and
PostgreSQL, but I have not worked with MS SQL. Playing with it after
installing it, and running through several tutorials, I generally like
what I see, but there are a few issues (so far - I am sure others will
crop up as...
| |
by: Florence Tissot |
last post by:
We are seeing some kind of resource leak in our performance lab running an ASP.NET (2.0) application that sends and receives messages from 2 public MSMQ queues. Here's a brief summary of what are application does:
1. user provides input on a form on an aspx page and clicks continues
2. on postback, the page creates a c# .net object and calls a method on it to process the data provided by the user
3. the object in turns creates an...
|
by: jmcgrew |
last post by:
I'm not very familiar with ASP.NET, so any pointers would be
appreciated.
I'm developing a C# program which will basically run in the background
as a server. I want to have a web-based front end which people can use
to configure the server, edit their accounts, upload new data, etc.
One way to implement this would be for the server to accept
connections on a special port, and the ASP pages would connect to the
server and talk over the...
|
by: Andrew Ducker |
last post by:
I have an application, and I'd like it to be able to generate "log"
messages. Other applications can then attach to it and listen to
these messages, but the main application shouldn't have to worry about
how many other apps are listening in, what they do with the messages,
etc.
Can I do this with Remoting?
Cheers,
|
by: lmod |
last post by:
I am developing an application using WPF and WCF. This app on the
server side will need for WCF services hosted in IIS6 to communicate
with WCF services that are hosted as Windows services on the same server
/ or network. Also the WCF services hosted in IIS6 has to communicate
with the WPF client apps that will be installed on computers that are
not in the same network as the server/s. Right now I am creating small
test apps so I can...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |