zoukankan      html  css  js  c++  java
  • ChannelFactory

    ChannelFactory

     

     

    The following example illustrates how to use the ChannelFactory class to create a channel on the client to send messages with the service endpoint.

     

    In order to create and manage channels, you need to import the System.ServiceModel.Channels namespace.

     

    Let’s take a look at the following code snippet.

     

    ChannelFactory<TCP.IServiceClass> factory = new

    ChannelFactory<TCP.IServiceClass>(“WSHttpBinding_IServiceClass”);

    TCP.IServiceClass channel = factory.CreateChannel();

     

    The above code is the construction and management of the channel. The first line initializes a new instance of the ChannelFactory class. This is necessary to create the channel. In the constructor of this class, you pass the name of the endpoint in which this channel will communicate. The second line creates the channel (Service Contract) which is used to communicate with the client.

     

    Next is to call the exposed method, then release ChannelFacotry instance.

    result = channel.AddNumbers(val1, val2);

    factory.Close();

     

     

  • 相关阅读:
    标准粒子群算法(PSO)
    Java开发中的23种设计模式详解
    分布式事务
    sjk 分页
    有用吗2
    有用吗1
    存储过程
    在虚拟机Linux安装Redis
    ajax调用WebAPI添加数据
    SVN安装和使用(简单版)
  • 原文地址:https://www.cnblogs.com/rickie/p/1060316.html
Copyright © 2011-2022 走看看