62,046
社区成员
发帖
与我相关
我的任务
分享
protected void Button1_Click(object sender, EventArgs e)
{
MessageQueue queue = new MessageQueue();
if (!MessageQueue.Exists(".\\private$\\BookShopOrders"))
{
MessageQueue.Create(".\\private$\\BookShopOrders");
}
queue.Path = ".\\private$\\BookShopOrders";
queue.Send(TextBox1.Text,MessageQueueTransactionType.Single);
Label2.Text = "ok";
}
protected void Button2_Click(object sender, EventArgs e)
{
string[] types = { "System.String"};
MessageQueue queue = new MessageQueue();
queue.Formatter = new XmlMessageFormatter(types);
queue.Path = ".\\private$\\BookShopOrders";
Message message = queue.Receive();
Label1.Text = (string)message.Body;
}