Partager via


EndpointAddress.ApplyTo Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Assigns the URI and properties of the endpoint address to the values of the headers of a specified message.

Namespace:  System.ServiceModel
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

Syntax

'Declaration
Public Sub ApplyTo ( _
    message As Message _
)
public void ApplyTo(
    Message message
)

Parameters

Exceptions

Exception Condition
ArgumentNullException

message is nulla null reference (Nothing in Visual Basic).

Remarks

The ApplyTo(Message) method sets the To of the message with the Uri of the current EndpointAddress. Remember that ApplyTo means here to "apply this address to the To header of the message".

Examples

            '
            Dim addressHeader5 As AddressHeader = AddressHeader.CreateAddressHeader("specialservice5", "https://localhost:8000/service", 2)
            Dim endpointAddress2 As New EndpointAddress(New Uri("https://localhost/silverlightsamples/service1"), addressHeader5)
            Dim message As Message = Message.CreateMessage(MessageVersion.Soap11, Nothing)
            endpointAddress2.ApplyTo(message)
            Dim messageHeaders As MessageHeaders = message.Headers
//
AddressHeader addressHeader5 = AddressHeader.CreateAddressHeader("specialservice5", "https://localhost:8000/service", 2);
EndpointAddress endpointAddress2 = new EndpointAddress(
    new Uri("https://localhost/silverlightsamples/service1"), addressHeader5
    );
Message message = Message.CreateMessage(MessageVersion.Soap11, null);
endpointAddress2.ApplyTo(message);
MessageHeaders messageHeaders = message.Headers;

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.