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();

     

     

  • 相关阅读:
    74.Interesting Sequence(有趣的数列)(拓扑排序)
    CODEVS 1746 贪吃的九头龙
    NYOJ 110 剑客决斗
    CODEVS 2451 互不侵犯
    洛谷 P1896 互不侵犯King
    洛谷 P1066 2^k进制数
    洛谷 P1656 炸铁路
    洛谷 P1830 轰炸Ⅲ
    CODEVS 1051 接龙游戏
    POJ 3461 Oulipo
  • 原文地址:https://www.cnblogs.com/rickie/p/1060316.html
Copyright © 2011-2022 走看看