当我发送guid作为消息并接收它时,消息变得很奇怪:
@Guide3http://schemas.microsoft.com/2003/10/Serialization/�$ed92ba5c-68ed-2a4c-8d89-0a087e47ef11
知道为什么我不能只收到Guid的消息吗?
发件人:
public void Post(Guid id) {
var connectionString = "X";
var queueName = "Send";
var client = QueueClient.CreateFromConnectionString(connectionString, queueName);
var message = new BrokeredMessage(id);
client.Send(message);
}接受者:
public string ReadPost() {
var connectionString = "X";
var queueName = "Send";
var client = QueueClient.CreateFromConnectionString(connectionString, queueName);
var message = client.Receive(TimeSpan.FromMinutes(1));
var stream = message?.GetBody<Stream>();
if (stream == null) { return null; }
var reader = new StreamReader(stream);
var textFromBody = reader.ReadToEnd();
message.Complete();
return textFromBody;
}发布于 2016-12-07 14:41:34
试试这个:
message.GetBody<Guid>();而不是得到溪流。
服务总线队列使用DataContractSerializer来序列化消息体,这就是您所看到的。
https://stackoverflow.com/questions/41019929
复制相似问题