当前位置: 首页>>代码示例>>C#>>正文


C# ChannelFactory.Open方法代码示例

本文整理汇总了C#中ChannelFactory.Open方法的典型用法代码示例。如果您正苦于以下问题:C# ChannelFactory.Open方法的具体用法?C# ChannelFactory.Open怎么用?C# ChannelFactory.Open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ChannelFactory的用法示例。


在下文中一共展示了ChannelFactory.Open方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

	public static void Main ()
	{
		var binding = new NetNamedPipeBinding ();
		binding.TransferMode = TransferMode.Streamed;
		binding.Security.Mode = NetNamedPipeSecurityMode.None;
		IFooChannel proxy = new ChannelFactory<IFooChannel> (
			binding,
			new EndpointAddress ("net.pipe://localhost/samplepipe")
			).CreateChannel ();
		proxy.Open ();
		Console.WriteLine (proxy.Echo ("TEST FOR ECHO"));
		Console.WriteLine (proxy.Add (1000, 2000));
	}
开发者ID:alesliehughes,项目名称:olive,代码行数:13,代码来源:samplecli8.cs

示例2: Main

	public static void Main ()
	{
		var uri = new Uri ("soap.udp://239.255.255.250:3802");
		for (int i = 0; i < 2; i++) {
		var binding = new UdpAnnouncementEndpoint (uri).Binding;
		IFooChannel proxy = new ChannelFactory<IFooChannel> (
			binding,
			new EndpointAddress (uri)
			).CreateChannel ();
		proxy.Open ();
		proxy.SendMsg ("TEST FOR ECHO");
		}
	}
开发者ID:alesliehughes,项目名称:olive,代码行数:13,代码来源:udp-client.cs

示例3: CreateChannel_Of_Typed_Proxy_Using_BasicHttpBinding

    // Create the channel factory using BasicHttpBinding and open the channel using a user generated interface
    public static void CreateChannel_Of_Typed_Proxy_Using_BasicHttpBinding()
    {
        ChannelFactory<IWcfServiceGenerated> factory = null;
        try
        {
            BasicHttpBinding binding = new BasicHttpBinding();

            // Create the channel factory
            factory = new ChannelFactory<IWcfServiceGenerated>(binding, new EndpointAddress(BaseAddress.HttpBaseAddress));
            factory.Open();

            // Create the channel.
            IWcfServiceGenerated channel = factory.CreateChannel();

            Assert.True(typeof(IWcfServiceGenerated).GetTypeInfo().IsAssignableFrom(channel.GetType().GetTypeInfo()),
                String.Format("Channel type '{0}' was not assignable to '{1}'", channel.GetType(), typeof(IRequestChannel)));
        }
        finally
        {
            if (factory != null)
            {
                factory.Close();
            }
        }
    }
开发者ID:shijiaxing,项目名称:wcf,代码行数:26,代码来源:ChannelFactoryTest.cs


注:本文中的ChannelFactory.Open方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。