473,388 Members | 1,426 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Unable to cast MSMQ body to an object

Hi,

I built an assembly with a class, NodeBuildCommand, in the namespace
"Tendril". I use that assembly on one computer to send a
NodeBuildCommand object in the body of a System.Messaging.Message.
This works without error. On the receiving computer I use the same
assembly and then try to cast the body to that object. When this
happens I get a "Type not found error" from GetType(), which is called
from the get_Body() method on the System.Messaging.Message object.

In the development environment on the remote computer in the Immediate
window of the debugger I can do the following:

(new Tendril.NodeBuildCommand()).GetType().Name = "NodeBuildCommand"

(new Tendril.NodeBuildCommand()).GetType().Namespace = "Tendril"

so why doesn't this work:

System.Type.GetType("Tendril.NodeBuildCommand")

This last line returns null and this is the source of my problem with
the casting. Any ideas on how to proceed?

Thanks,
Bill

Oct 1 '07 #1
1 2262

You need to beomce famaliar with the formatter argument
System.Messaging.IMessageFormatter


Here is smoe sample code:

public class MyMSMQListener
{

MessageQueue _queue = null;
public MyMSMQListener(string queuePath ,
System.Messaging.IMessageFormatter formatter, int receiveOrPeekMilliSeconds)
{
this.ConstructorCommon(queuePath , receiveOrPeekMilliSeconds);
this._queue.Formatter = formatter; // Customize the formatter type
}

private void ConstructorCommon(string queuePath , int
receiveOrPeekMilliSeconds)
{

Console.WriteLine("MyMSMQListenerwas constructed");

this._queue = new MessageQueue(queuePath);

this.m_receiveOrPeekMilliSeconds = receiveOrPeekMilliSeconds;

}

}


"Bill Wright" <Bi***********@gmail.comwrote in message
news:11*********************@r29g2000hsg.googlegro ups.com...
Hi,

I built an assembly with a class, NodeBuildCommand, in the namespace
"Tendril". I use that assembly on one computer to send a
NodeBuildCommand object in the body of a System.Messaging.Message.
This works without error. On the receiving computer I use the same
assembly and then try to cast the body to that object. When this
happens I get a "Type not found error" from GetType(), which is called
from the get_Body() method on the System.Messaging.Message object.

In the development environment on the remote computer in the Immediate
window of the debugger I can do the following:

(new Tendril.NodeBuildCommand()).GetType().Name = "NodeBuildCommand"

(new Tendril.NodeBuildCommand()).GetType().Namespace = "Tendril"

so why doesn't this work:

System.Type.GetType("Tendril.NodeBuildCommand")

This last line returns null and this is the source of my problem with
the casting. Any ideas on how to proceed?

Thanks,
Bill

Oct 1 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
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...
5
by: Pete Loveall | last post by:
I have a server application that monitors a private local queue for messages. The message sent to it has a label and a response queue defined. It works correctly when the queue is accessed via...
0
by: Kimmo Laine | last post by:
Hi, how can i be sure that the MSMQ Message.Body property contains something valid? If i send the message like this: public void SendMyMessage( int msgCode, object msgData ) { Message msg =...
4
by: SRLoka | last post by:
I have an application that has five threads. All five threads write to the same MSMQ. All five threads are using the same global instance to send data to the MSMQ server(on same machine)....
1
by: Richard Atkinson | last post by:
I would appreciate help on the Microsoft Message Queue. Basically I would like to Serialize an entire class into a message queue and then reinstantiate the class in another application from the...
1
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I have a master page and a content page to that master. When I try to work with them I get an inconsistent error of casting ability and it happens irregularly, which means sometimes it can work...
1
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...
2
by: Bigi | last post by:
Hi, Please help, this has been driving me nuts for nearly 2 days now. This vb6 code works: Public oEng As New ebizEngine Public oMsg As ebizMessage Function EbizGetFromQueue() As String
0
by: lgrella | last post by:
I am using MSMQ and am using the triggers. What I am doing is running a web service, and placing parameters to a call to a 3rd party program in the body of the message object of a queue. I want the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.