有一些类似的问题,我对MSMQ非常新.
我一直在尝试将ServiceContract和关联的DataContract链接到MSMQ,并设置了端点,以便DataContact消息在MSMQ中结束.
我已经验证了WCF服务正确生成了消息,我还可以看到消息在我发送到的队列的日志中,但不在我期望它们的实际"排队消息"区域中.
我目前没有使用交易,我已将安全性设置为无.我附上相关的代码,虽然我的感觉是我因为无知MSMQ而缺少一些基本的东西.任何指针将不胜感激.
服务和数据合同
[DataContract]
public class RegistrationMessage : IRegistrationMessage
{
[DataMember]
public string EMailAddress { get; set; }
[DataMember]
public string FirstName { get; set; }
[DataMember]
public string LastName { get; set; }
}
[ServiceContract]
public interface IRegistration
{
[OperationContract(IsOneWay = true)]
void Register(RegistrationMessage message);
}
Run Code Online (Sandbox Code Playgroud)
WCF主机的app.config
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MetaDataBehaviour">
<serviceMetadata httpGetEnabled="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netMsmqBinding>
<binding name="msmq"
deadLetterQueue="System" durable="true"
exactlyOnce="false"
receiveContextEnabled="false"
useMsmqTracing="true">
<security mode="None" />
</binding>
</netMsmqBinding>
</bindings>
<services>
<service behaviorConfiguration="MetaDataBehaviour" …Run Code Online (Sandbox Code Playgroud)