protected virtual ServiceEndpoint AddServiceEndpoint(ServiceHost serviceHost, BindingAddressEndpointModel model) { var binding = GetEffectiveBinding(model.Binding, serviceHost, model.Address); if (model.HasViaAddress) { return serviceHost.AddServiceEndpoint( model.Contract, binding, model.Address, model.ViaAddress); } else { return serviceHost.AddServiceEndpoint(model.Contract, binding, model.Address); } }
void IWcfEndpointVisitor.VisitBindingAddressEndpoint(BindingAddressEndpointModel model) { serviceEndpoint = builder.AddServiceEndpoint(serviceHost, model); }
void IWcfEndpointVisitor.VisitBindingAddressEndpoint(BindingAddressEndpointModel model) { if (model.HasViaAddress) { var address = model.EndpointAddress ?? new EndpointAddress(model.Address); var description = ContractDescription.GetContract(contract); var binding = GetEffectiveBinding(model.Binding, address.Uri); var endpoint = new ServiceEndpoint(description, binding, address); endpoint.Behaviors.Add(new ClientViaBehavior(model.ViaAddress)); channelCreator = GetChannel(contract, endpoint); } else { if (model.EndpointAddress != null) { var binding = GetEffectiveBinding(model.Binding, model.EndpointAddress.Uri); channelCreator = GetChannel(contract, binding, model.EndpointAddress); } else { var binding = GetEffectiveBinding(model.Binding, new Uri(model.Address)); channelCreator = GetChannel(contract, binding, model.Address); } } }