AddressFilterMode 枚举

定义

指定调度程序用于将传入消息路由到正确终结点的匹配语义的类型。Specifies the type of match semantics used by the dispatcher to route incoming messages to the correct endpoint.

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

字段

Any 2

指示与传入消息的任意地址相匹配的筛选器。Indicates a filter that matches on any address of an incoming message. 使用此值可以关闭 WCF 地址筛选器检查。Using this value turns off the WCF address filter check. 接受任何消息,无论其 WS-Addressing:To 标识是什么。Any message, no matter what its WS-Addressing:To identity, is accepted.

Exact 0

指示对传入消息的地址执行精确匹配的筛选器。Indicates a filter that does an exact match on the address of an incoming message.

Prefix 1

指示对传入消息的地址执行最长前缀匹配的筛选器。Indicates a filter does the longest prefix matches on the address of an incoming message.

示例

[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 属性上设置。The value of the AddressFilterMode enumeration is set on the ServiceBehaviorAttribute.AddressFilterMode property.

前缀指定的最长前缀匹配条件要求目标地址与筛选器中的最大前导地址位数相匹配。The longest prefix match criterion specified by Prefix requires that the destination address be matched by the largest number of leading address bits in the filter. 默认值为 "精确"。The default value is Exact.

适用于