【发布时间】:2011-02-25 13:43:02
【问题描述】:
我有一个使用 netMsmqBinding 的 WCF 服务,用于将 Msmq<string> 的消息添加到队列中。消息添加得很好,我可以通过计算机管理控制台在队列中看到它们。
我有另一个 WCF 服务正在尝试从队列中检索消息,这就是我遇到问题的地方。每当将消息添加到队列中时(该位工作正常),我的服务中的方法就会被调用,但 Msmq<string> 消息似乎具有所有空值。
我不确定如何从Msmq<string> 那里得到消息?这是我的服务细节...任何帮助表示赞赏..
[ServiceContract]
[ServiceKnownType(typeof(Msmq<string>))]
public interface IMessageListener
{
[OperationContract(IsOneWay = true, Action = "*")]
void ListenForMessage(Msmq<string> msg);
}
public class MessageListener : IMessageListener
{
[OperationBehavior(TransactionScopeRequired = false, TransactionAutoComplete = true)]
public void ListenForMessage(MsmqMessage<string> msg)
{
//this gets called and seems to remove the message from the queue, but message attributes are all null
}
}
【问题讨论】:
-
首先:您的实现类中的方法不需要 [OperationContract] - 实际上,您不应该在那里拥有该属性
标签: wcf netmsmqbinding