共用方式為


AddressFilterMode 列舉

定義

指定發送器所用的符合語意型別,可以將傳入訊息路由至正確端點。

public enum class AddressFilterMode
public enum AddressFilterMode
type AddressFilterMode = 
Public Enum AddressFilterMode
繼承
AddressFilterMode

欄位

Any 2

表示會比對傳入訊息上任何位址的篩選條件。 使用此值會關閉 WCF 位址篩選檢查。 接受任何訊息,不論其 WS-Addressing:To 身分識別為何。

Exact 0

表示在傳入訊息上進行完全相符比對的篩選條件。

Prefix 1

表示在傳入訊息上進行最長前置比對的篩選條件。

範例

[ServiceBehavior(AddressFilterMode = AddressFilterMode.Prefix)]
public class CalculatorService : ICalculator
{
    public double Add(double n1, double n2)
    {
        return n1 + n2;
    }

    public double Subtract(double n1, double n2)
    {
        return n1 - n2;
    }

    public double Multiply(double n1, double n2)
    {
        return n1 * n2;
    }

    public double Divide(double n1, double n2)
    {
        return n1 / n2;
    }
}
<ServiceBehavior(AddressFilterMode := AddressFilterMode.Prefix)> _
Public Class CalculatorService
    Implements ICalculator
    Public Function Add(ByVal n1 As Double, ByVal n2 As Double) As Double Implements ICalculator.Add
        Return n1 + n2
    End Function

    Public Function Subtract(ByVal n1 As Double, ByVal n2 As Double) As Double Implements ICalculator.Subtract
        Return n1 - n2
    End Function

    Public Function Multiply(ByVal n1 As Double, ByVal n2 As Double) As Double Implements ICalculator.Multiply
        Return n1 * n2
    End Function

    Public Function Divide(ByVal n1 As Double, ByVal n2 As Double) As Double Implements ICalculator.Divide
        Return n1 / n2
    End Function
End Class

備註

AddressFilterMode 列舉的值是在 ServiceBehaviorAttribute.AddressFilterMode 屬性上設定。

Prefix 所指定的最長前置詞比對準則,要求目的地位址符合篩選準則中前置位址位的最大數目。 預設值為 Exact。

適用於