可以使用 Windows Communication Foundation (WCF) 客户端配置来指定客户端终结点的地址 (Address)、绑定 (Binding)、行为 (Behavior) 和协定 (Contract),即客户端终结点的“ABC”属性来连接服务终结点。
此外,
通过客户端配置,客户端可以指定一个或多个终结点,每个终结点都有自己的名称、地址和协定,并且每个终结点都引用客户端配置中要用于配置该终结点的
name="endpoint1"
address="http://localhost/ServiceModelSamples/service.svc"
binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IHello"
behaviorConfiguration="IHello_Behavior"
contract="IHello" >
type="Microsoft.ServiceModel.Samples.WsdlDocumentationImporte r, WsdlDocumentation"/>
// Add another endpoint by adding another element.
name="endpoint2">
//Configure another endpoint here.
//The bindings section references by the bindingConfiguration endpoint attribute.
bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard">
enabled="false" />
//Security settings go here.
//Configure this binding here.
//The behavior section references by the behaviorConfiguration endpoint attribute.
可选的name 属性唯一地标识了给定协定的终结点。 它由 ChannelFactory<</SPAN>TChannel> 或 ClientBase<</SPAN>TChannel> 用于指定客户端配置中的哪个终结点是目标终结点,必须在创建到服务的通道时加载。 通配符终结点配置名称“*”可用,并且指示 ApplyConfiguration 方法,如果文件中正好有一个终结点配置,就应加载该终结点配置,否则引发异常。 如果省略此属性,则将对应的终结点用作与指定协定类型相关联的默认终结点。 name 属性的默认值是一个空字符串,它与任何其他名称一样进行匹配。
每个终结点都必须具有一个与之关联的地址,用于查找和标识终结点。
binding
behaviorConfiguration
contract