Welcome to MSDN Blogs Sign in | Join | Help

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

Published Friday, May 09, 2008 5:00 AM by Nicholas Allen

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

Friday, May 09, 2008 10:57 AM by Code Monkey Labs

# Weekly Web Nuggets #11

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

Friday, May 09, 2008 11:34 AM by Nicholas Allen's Indigo Blog

# Generating Types with Lists

I have a data contract that contains a collection type but the generated proxy appears as an array. How

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker