Default Action for your [OperationContract]

Question of the Day: what is the action for my OperationContract?

Answer: if not set explicitly, the action is contractNamespace + contractName + “/” + operationName. For responses, tack on “Response” at the end of this string.

By default, contractNamespace == “”, contractName == class name, and operationName == method name. These names can be specified explicitly through ServiceContractAttribute.Namespace, ServiceContractAttribute.Name, and OperationContractAttribute.Name respectively.

As an example, if you have the following operation:

class MyService

public string SampleHello(string name)

return string.Format(“Hello {0}.”, name);



the request action is, and the response action is

Alternatively, you can specify the action(s) of your method with the Action and ReplyAction parameters to OperationContract (i.e. [OperationContract(Action=”myAction”, ReplyAction=”myReplyAction”)]

2 thoughts on “Default Action for your [OperationContract]

  1. Pingback: : .NET Resources

  2. Pingback: » Blog Archive » Using Overloaded Operations in your ServiceContract

Leave a Reply

Your email address will not be published. Required fields are marked *