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

属性值

字符串值,其值为服务正在侦听的地址。

示例

下面的示例演示如何访问 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;
        }
    }
}

注解

如果存在,则将使用此值来定义操作的终结点地址。

适用于