ISendMessageCallback.OnSendMessage(OperationContext) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Executed when a service message is sent.
public:
void OnSendMessage(System::ServiceModel::OperationContext ^ operationContext);
public void OnSendMessage (System.ServiceModel.OperationContext operationContext);
abstract member OnSendMessage : System.ServiceModel.OperationContext -> unit
Public Sub OnSendMessage (operationContext As OperationContext)
Parameters
- operationContext
- OperationContext
The operation's context under which the message is being sent.
Examples
The following example shows how to implement the ISendMessageCallback interface to a new header to a message before it is sent out on the wire.
class SendInstanceIdCallback : ISendMessageCallback
{
public const string HeaderName = "InstanceIdHeader";
public const string HeaderNS = "http://Microsoft.Samples.AccessingOperationContext";
public Guid InstanceId { get; set; }
public void OnSendMessage(System.ServiceModel.OperationContext operationContext)
{
operationContext.OutgoingMessageHeaders.Add(MessageHeader.CreateHeader(HeaderName, HeaderNS, this.InstanceId));
}
}
Applies to
Співпраця з нами на GitHub
Джерело цього вмісту можна знайти на GitHub, де також можна створювати й переглядати запитання та запити на внесення змін. Докладні відомості наведено в нашому посібнику для співавторів.