Integration with MSMQ on .NET Compact Framework 2.0

Hi,

I want to explore the possibility of integration between MSMQ on .NET CF 2.0 and Indigo.
First I want to test sending messages from Pocket PC to Indigo.
MSMQ on Pocket PC doesn't have authentication, encryption or transaction notions, has xml formatter only, and MSMQ is installed in workgroup mode on the desktop computer. This is the configuration file:
<services>
            <service
                type="MSMQIntegration.MessageProcessor"
                behaviorConfiguration="MessageProcessorBehavior">
                <endpoint address="msmq.formatname:DIRECT=OS:.\private$\destq"
                        binding="msmqIntegrationBinding"
                        bindingConfiguration="MessageProcessorBinding"
                        contract="MSMQIntegration.IMessageProcessor">
                </endpoint>
            </service>
        </services>

        <bindings>
            <msmqIntegrationBinding>
                <binding configurationName="MessageProcessorBinding"
                        durable="True"
                        exactlyOnceDelivery="False"
                        serializationFormat="Xml"
                        >
                    <security mode="None" />
                </binding>
            </msmqIntegrationBinding>
        </bindings>

        <behaviors>
            <behavior
                configurationName="MessageProcessorBehavior"
                returnUnknownExceptionsAsFaults="False" >
                <serviceAuthorization principalPermissionMode="None"/>
            </behavior>
        </behaviors>

It is not working, I don't see anything, not even an exception. I see the messages in the journal queue so the messages have arrived and have been processed but the operation method is not fired.
I must mention if I use MSMQ from .NET 2.0 on the desktop computer instead of Indigo everything works fine.

Thank you,
Valentin Iliescu



Answer this question

Integration with MSMQ on .NET Compact Framework 2.0

  • esteves_plk

    The code is:

    namespace MSMQIntegration
    {
        public partial class Form1 : Form
        {
            MessageProcessor processor;

            public Form1()
            {
                InitializeComponent();

                processor = new MessageProcessor();
               
            }

            private void Form1_Load(object sender, EventArgs e)
            {
                processor.Start();
            }

            private void Form1_FormClosed(object sender, FormClosedEventArgs e)
            {
                processor.Stop();
            }
        }

        [ServiceBehavior()]
        public class MessageProcessor : IMessageProcessor
        {
            private ServiceHost serviceHost;

            public MessageProcessor()
            {
                serviceHost = new ServiceHost(typeof(MessageProcessor));
            }

            public void Start()
            {
                if (serviceHost != null)
                {
                    serviceHost.Open();
                }
            }

            public void Stop()
            {
                if (serviceHost != null)
                {
                    serviceHost.Close();
                }
            }

            public void Process(MsmqMessage<string> msg)
            {
                MessageBox.Show(msg.Body);
            }
        }

       [ServiceContract()]
        public interface IMessageProcessor
        {
            [OperationContract(IsOneWay = true, Action = "*")]
            void Process(MsmqMessage<String> msg);
        }

    }


  • Sagar-1

    I've found out that the problem is probably located to the non-public field property being null after deserilization of the message. I've also noticed that no matter the sice of the body of the message the message is 103 bytes in the queue. (When I used integrationbinding that same message was 664)

    Hope this gives a bit of information that can help some one help me :-)

    Take care

    Rune


  • steve callahan

    Yes, it works. Thank you very much.

    Valentin


  • mrmrcoleman

    You are very welcome!!

  • Rodrigo Diaz


    Can you please share your ServiceContract code here.
    Do you have Action="*" in the OperationContract attribute like below

    [ServiceContract()]
    public interface IOrderProcessor
    {
       [OperationContract(IsOneWay = true, Action = "*")]
       void SubmitPurchaseOrder(MsmqMessage<PurchaseOrder> msg);
    }
    }

    thanks
    Anand

  • Shaile

    Please try the following

    a. Add a reference to System.Runtime.Serialization
    b. Add the KnownType attribute to the ServiceContract like below

    [ServiceContract()]
    [
    KnownType(typeof(string))]
    public interface IMessageProcessor
    {
       [
    OperationContract(IsOneWay = true, Action = "*")]
       void Process(MsmqMessage<String> msg);
    }

    This should fix the problem
    Please let me know

    thanks,
    -Anand



  • Joe Barry

    I have a similiar problem as described above but when I do as suggested here (KnownType) I get a compilation error. Telling me that the knowntype attribute is only applicable for classes and structs (not interfaces) adding the KnownType attribute to the class implementing the contract does not help avoid the mentioned problem.

    Any suggestions


  • Integration with MSMQ on .NET Compact Framework 2.0