Understanding Address Filtering
Ordinarily a message is delivered to an endpoint on the basis of the message's delivery address being equal to the endpoint's listening address. If there's no endpoint listening at that address then you get an EndpointNotFoundException and the message fails to be delivered. This is the exact matching model between the To address and the endpoint address.
Sometimes though you want to be more lenient about how messages are delivered to endpoints. For example, if you want to process part of the address yourself, then you may want to match on a shorter address path while accepting messages being sent to any subpath. This is the prefix matching model.
The use of different matching models for associating messages and endpoints is part of the local behavior of the service. You can specify how to do matching using the AddressFilterMode property on the ServiceBehavior attribute.
[ServiceBehavior(AddressFilterMode = AddressFilterMode.Exact)]
There are three choices for performing matching.
- Exact: the default matching model is to require an exact match between the incoming message address and the endpoint address
Prefix: a weaker matching model is to require that the incoming message address is any path that is at least as specific as the endpoint address
- Any: the weakest matching model is to simply match every address
Comments
- Anonymous
June 04, 2009
This is one of the hidden gems which WCF developers would want to use. thanks for bringing this up with a good example.