msmqIntegrationBinding 綁定用來在一個(gè)WCF應(yīng)用程序和一個(gè)直接利用MSMQ的應(yīng)用程序間通信-比如,使用System.Messaging.這允許開發(fā)人員利用WCF同時(shí)也使用他們已有的MSMQ應(yīng)用程序。msmqIntegrationBinding綁定允許MSMQ消息映射到WCF消息。這通過在MsmqMessage類中對(duì)MSMQ消息包裝來實(shí)現(xiàn)的。類位于System.ServiceModel.MsmqIntegration命名空間里。實(shí)例可以使用單向契約被發(fā)送或接收。
?? 下面的代碼顯示了msmqIntegrationBinding綁定的地址格式:
?? msmq.formaname:{MSMQ format name}
?? MSMQ地址格式不需要端口來確定。然后,MSMQ需要打開特定端口,比如1801.表4.12顯示了msmqIntegrationBinding綁定的可以配置的屬性。
表4.12 msmqIntegrationBinding綁定屬性
?
?列表4.30 顯示了使用msmqIntegrationBinding綁定暴露一個(gè)服務(wù)的最小配置
?列表4.30 msmqIntegrationBinding 宿主配置
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <services> <service name="EssentialWCF.StockQuoteRequestService"> <endpoint address="msmq.formatname:DIRECT=OS:.\private$\stockquoteresponse" binding="msmqIntegrationBinding" contract="EssentialWCF.IStockQuoteRequest" /> </service> </services> </system.serviceModel></configuration>
調(diào)用由msmqIntegrationBinding綁定生成的服務(wù)的最小配置在列表4.31中顯示
???列表4.31 msmqIntegrationBinding 客戶端配置
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <services> <service name="EssentialWCF.HelloWorld"> <endpoint address="msmq.formatname:DIRECT=OS:.\private$\stockquoteresponse" binding="msmqIntegrationBinding" contract="EssentialWCF.IStockQuoteRequestService" /> </service> </services> </system.serviceModel></configuration>
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號(hào)聯(lián)系: 360901061
您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對(duì)您有幫助就好】元
