Client:
Message msg = new Message();
string str = "microsoft";
byte[] content = System.Text.Encoding.Utf8.GetBytes(str);
byte[] header = new byte[4];
header = BitConverter.GetBytes(content.Length);
byte[] cmd = new byte[1];
cmd = BitConverter.GetBytes(82);
byte[] b = new byte[content.Length + 5];
header.CopyTo(b, 0);
b[4] = cmd[0];
content.CopyTo(b, 5);
MemoryStream ms = new MemoryStream();
// ms.Write(header,0,header.Length);
// ms.Write(cmd,0,cmd.Length);
ms.Write(b, 0, b.Length);
msg.BodyStream = ms;
Then,I can't receive this message in service use msmqIntegrationBinding.Why

How can receive plain text Message?
Little_Dice
service:
using (ServiceHost serviceHost = new ServiceHost(typeof(OrderProcessorService)))
{
serviceHost.Open();
// The service can now be accessed.
Console.WriteLine("The service is ready.");
Console.WriteLine("Press <ENTER> to terminate service.");
Console.ReadLine();
// Close the ServiceHostBase to shutdown the service.
serviceHost.Close();
}
Config:
<services>
<service
name="Microsoft.ServiceModel.Samples.OrderProcessorService">
<endpoint address="msmq.formatname:DIRECT=OS:.\private$\Orders"
binding="msmqIntegrationBinding"
bindingConfiguration="OrderProcessorBinding"
contract="Microsoft.ServiceModel.Samples.IOrderProcessor">
</endpoint>
</service>
</services>
<bindings>
<msmqIntegrationBinding>
<binding name="OrderProcessorBinding" exactlyOnce="true" >
<security mode="None" />
</binding>
</msmqIntegrationBinding>
</bindings>
a.s.viswa
Hi,
Did you try Leszek's suggestion
Did that work for you
thanks
AnandRaj
furjaw
Please take a look at AnandRaj's reply in this thread:
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=98336&SiteID=1
Jassim Rahma
Hello,
by default MsmqIntegrationBinding has SerializationFormat set to Xml. Given that, it expects the data to be serialized using XmlSerializer.
In order to consume plain-text messages you'll have to switch to a different serialization format (ByteArray or Stream).
- leszek