Setting the Configuration Name
What's the difference between the Name and ConfigurationName on service contracts and behaviors?
The Name property sets the name of the service in metadata while the ConfigurationName property sets the name of the service in configuration. Metadata is the part of the service description that is transmitted to others when they interrogate your service. Configuration is the purely local settings for controlling the service.
Since Name is more commonly used, I'll just run through a quick example focusing on setting ConfigurationName instead. Here I've got a service contract and implementation setting both the Name and ConfigurationName properties.
[ServiceContract(Name="NotIService", ConfigurationName="IService")]
public interface IMyService
{
[OperationContract]
void DoNothing();
}
[ServiceBehavior(Name = "NotService", ConfigurationName = "Service")]
public class MyService : IMyService
{
public void DoNothing()
{
}
}
In my app.config file, the way I'd refer to that service and service endpoint is by the ConfigurationName.
<service name="Service">
<endpoint
address="http://localhost:8000/" binding="basicHttpBinding"
bindingConfiguration="myBindingConfiguration" contract="IService"/>
</service>
On the other hand, everywhere in the metadata, generated proxy, and even the generated proxy configuration file the service will appear as NotIService and NotService.
Next time: Disabling the Visual Studio Service Host