有人知道如何使用WCF *实现MSMQ Listeners *吗?
@H_403_3@解决方法
您无需在服务上手动实现队列侦听器.
只需创建服务操作合同,您就可以指定当消息到达队列时将调用的处理程序方法.
你可能(或应该)有这样的东西:
[OperationContract(IsOneWay = true,Action = "*")] void HandleMyMessage (MsmqMessage<String> message);
这将确保在传递消息时将调用服务实现中的HandleMyMessage()方法.
UPDATE
在下面的评论中回答您的问题,要定义队列地址,您可以在< System.ServiceModel>中执行此操作.组态:
<services> <service name="Microsoft.ServiceModel.Samples.OrderProcessorService" behaviorConfiguration="CalculatorServiceBehavior"> <host> <baseAddresses> <add baseAddress="http://localhost:8000/ServiceModelSamples/service"/> </baseAddresses> </host> <!-- Define NetMsmqEndpoint --> <endpoint address="net.msmq://localhost/private/ServiceModelSamplesTransacted" binding="netMsmqBinding" contract="Microsoft.ServiceModel.Samples.IOrderProcessor" /> <!-- the mex endpoint is exposed at http://localhost:8000/ServiceModelSamples/service/mex --> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services>