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="https://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
Comments
Anonymous
May 09, 2008
Understanding Model-View-Controller : Introducing developers to the MVC concept can, at times, be a challenging endeavor. Jeff Atwood has put together a very informative post that may be able to help! Mocking Frameworks Benchmarked : In search of a fasterAnonymous
May 09, 2008
I have a data contract that contains a collection type but the generated proxy appears as an array. HowAnonymous
February 22, 2009
Understanding Model-View-Controller : Introducing developers to the MVC concept can, at times, be a challenging endeavor. Jeff Atwood has put together a very informative post that may be able to help! Mocking Frameworks Benchmarked : In search of a faster