c# – 使用WCF的MSMQ监听器
发布时间:2020-12-15 07:48:01 所属栏目:百科 来源:网络整理
导读:有人知道如何使用WCF *实现MSMQ Listeners *吗? 解决方法 您无需在服务上手动实现队列侦听器. 只需创建服务操作合同,您就可以指定当消息到达队列时将调用的处理程序方法. 你可能(或应该)有这样的东西: [OperationContract(IsOneWay = true,Action = "*")]v
有人知道如何使用WCF *实现MSMQ Listeners *吗?
解决方法
您无需在服务上手动实现队列侦听器.
只需创建服务操作合同,您就可以指定当消息到达队列时将调用的处理程序方法. 你可能(或应该)有这样的东西: [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> 从这里:http://msdn.microsoft.com/en-us/library/ms789032.aspx (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
热点阅读