AddressFilterMode 枚举
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
指定调度程序用于将传入消息路由到正确终结点的匹配语义的类型。
public enum class AddressFilterMode
public enum AddressFilterMode
type AddressFilterMode =
Public Enum 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。