共用方式為


SendActivity.CustomAddress 屬性

定義

取得或設定用來與服務通訊的自訂位址。

public:
 property System::String ^ CustomAddress { System::String ^ get(); void set(System::String ^ value); };
public string CustomAddress { get; set; }
member this.CustomAddress : string with get, set
Public Property CustomAddress As String

屬性值

String

字串值,其值為服務正在接聽的位址。

範例

下列範例將示範如何存取 CustomAddress 屬性。 這個範例是改自 CalculatorClient SDK 範例。

static public void ApplyEndpointAddress(SendActivity activity, EndpointAddress epr)
{
    if (activity.ExecutionStatus == ActivityExecutionStatus.Initialized)
    {
        if (epr.Uri != null)
        {
            activity.CustomAddress = epr.Uri.ToString();
        }
        if (epr.Headers != null && epr.Headers.Count > 0)
        {
            AddressHeader contextHeader = epr.Headers.FindHeader(contextHeaderName, contextHeaderNamespace);
            IDictionary<string, string> context = contextHeader.GetValue<Dictionary<string, string>>();
            activity.Context = context;
        }
    }
}

備註

若有此值,則此值會用來定義作業的端點位址。

適用於