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

     

     

  • 相关阅读:
    架构设计
    git 常用命令
    C# 加载C++的dll
    windows 服务部署管理
    wpf 模板绑定控件属性
    golang开启module模式 go mod
    使用docker安装redis
    使用docker安装elasticsearch
    使用docker安装etcd
    使用docker安装mysql5.7
  • 原文地址:https://www.cnblogs.com/rickie/p/1060316.html
Copyright © 2011-2022 走看看