LoginSignup
1
0

More than 5 years have passed since last update.

Azure WCF: an AddressFilter mismatch at the EndpointDispatcher.

Posted at

from this thread

AzureのWeb roleとかWorker roleとかはAzureプロジェクト上のRolesの設定から
TCPとかHTTPとかの接続を待ち受けるEndpointを定義できて、それをWorker role側コード上から

RoleInstanceEndpoint Endpoint 
  = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["Endpoint1"];

みたいな感じで読めるわけだけど、このコードで得られるポート番号が設定で決めたポートと異なる場合がある。
これは、Azureでは外部にポートを開くのはロードバランサであって、Roleが走るマシンは実際はロードバランサから接続を仲介してもらう為。

これはまだいいんだけど、WCFを使ってこのWorker roleと通信しようとしたとき、こんな例外を拾う事がある。

The message with To '...' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree.

これはサービスコントラクトのAddressFilterModeがデフォルトでAddressFilterMode.Exact(アドレスが厳密に一致しないとメッセージを受け付けない)になってる為。

EndpointにバインドしたサービスコントラクトにをAddressFilterMode.Anyをつけてやればいい。

[ServiceBehavior(AddressFilterMode=AddressFilterMode.Any)]

普通にアドレスtypoしてもこの例外は飛んでくるからこの例外見たらまずtypoを疑うのが正解かも。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0