Reputation: 9578
I use a the ChannelFactory way of communicating with my other business tier.
See this example: http://benmccallum.wordpress.com/2011/08/27/wcf-web-service-wrapper-closing-disposing-and-aborting-best-practices/
What does ChannelFactory("*") mean, I cannot get any information on MSDN about this ?
Upvotes: 1
Views: 146
Reputation: 125498
The *
wildcard indicates to use the first qualifying endpoint as you can have more than one endpoint for the same contract. I can't find any reference to this on MSDN, but can see it used internally inside ChannelFactory<T>.InitializeEndpoint(string configurationName, EndpointAddress address)
. Decompiled using Dotpeek, comments mine
protected void InitializeEndpoint(string configurationName, EndpointAddress address)
{
this.serviceEndpoint = this.CreateDescription();
ServiceEndpoint serviceEndpoint = (ServiceEndpoint) null;
if (configurationName != null)
// ConfigLoader checks whether the passed configurationName is a wildcard match
// and uses it when looking up channels from configuration to determine
// which channel to use
serviceEndpoint = ConfigLoader.LookupEndpoint(configurationName, address, this.serviceEndpoint.Contract);
if (serviceEndpoint != null)
{
this.serviceEndpoint = serviceEndpoint;
}
else
{
if (address != (EndpointAddress) null)
this.Endpoint.Address = address;
this.ApplyConfiguration(configurationName);
}
this.configurationName = configurationName;
this.EnsureSecurityCredentialsManager(this.serviceEndpoint);
}
Upvotes: 1