zoukankan      html  css  js  c++  java
  • WCF 第四章 绑定 msmqIntegrationBinding

    msmqIntegrationBinding 绑定用来在一个WCF应用程序和一个直接利用MSMQ的应用程序间通信-比如,使用System.Messaging.这允许开发人员利用WCF同时也使用他们已有的MSMQ应用程序。msmqIntegrationBinding绑定允许MSMQ消息映射到WCF消息。这通过在MsmqMessage类中对MSMQ消息包装来实现的。类位于System.ServiceModel.MsmqIntegration命名空间里。实例可以使用单向契约被发送或接收。

       下面的代码显示了msmqIntegrationBinding绑定的地址格式:

       msmq.formaname:{MSMQ format name}

       MSMQ地址格式不需要端口来确定。然后,MSMQ需要打开特定端口,比如1801.表4.12显示了msmqIntegrationBinding绑定的可以配置的属性。

    表4.12 msmqIntegrationBinding绑定属性

     

     列表4.30 显示了使用msmqIntegrationBinding绑定暴露一个服务的最小配置

     列表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>
    

    调用由msmqIntegrationBinding绑定生成的服务的最小配置在列表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>
    


    作者:DanielWise
    出处:http://www.cnblogs.com/danielWise/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    Docker之Harbor
    idea 代码块编辑(批量列编辑)快捷键 -- idea version 2018 不常用
    mysql 去除表中重复的数据,保留id最小的数据信息
    打家劫舍(动态规划+滚动数组+取模运算优化)
    利用线程异步调用
    idea 2019激活码
    mysql导出PDM表结构并带有注释
    安装GO
    GO语言
    项目启动
  • 原文地址:https://www.cnblogs.com/danielWise/p/1890281.html
Copyright © 2011-2022 走看看