【发布时间】:2011-09-09 03:19:22
【问题描述】:
有几个类似的问题,我对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);
}
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" name="Client.AuthenticationService.RegistrationService">
<endpoint address="net.msmq://localhost/private/AuthenticationQueue"
binding="netMsmqBinding"
bindingConfiguration="msmq" name="msmq"
contract="Global.DomainModel.IRegistration" />
<endpoint address="mex" binding="mexHttpBinding" name="mex" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/Registration/" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>
【问题讨论】: