本文整理汇总了C#中System.ServiceModel.HostNameComparisonMode枚举的典型用法代码示例。如果您正苦于以下问题:C# HostNameComparisonMode枚举的具体用法?C# HostNameComparisonMode怎么用?C# HostNameComparisonMode使用的例子?那么, 这里精选的枚举代码示例或许可以为您提供帮助。
在下文中一共展示了HostNameComparisonMode枚举的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SayHello
[ServiceContract()]
public interface ISayHello
{
[OperationContract()]
string SayHello();
}
public class HelloService : ISayHello
{
public string SayHello()
{
return "Hello, WCF!";
}
}
示例2: EndpointAddress
// Open up a channel factory on a client application.
ChannelFactory<ISayHello> factory = new ChannelFactory<ISayHello>("BasicHttpBinding_ISayHello");
// Both of these contracts work (provided both hostnames are valid) because
// the binding configuration is set to hostNameComparisonMode="StrongWildcard".
ISayHello channel = factory.CreateChannel(new EndpointAddress("http://localhost:8000/UESamples/HelloService"));
ISayHello channel2 = factory.CreateChannel(new EndpointAddress("http://machineName/UESamples/HelloService"));
Console.WriteLine(channel.SayHello());
Console.WriteLine();
Console.WriteLine("Press <ENTER> to terminate client.");
Console.ReadLine();