※ここで紹介するサンプルは下記のURLからダウンロードできます。 サービス側の設定 これは従来通り、WCFサービスの設定ファイルです。 <services> <service name="Microsoft.Samples.HelloRoutingService.CalculatorService" behaviorConfiguration="CalculatorServiceBehavior"> <host> <baseAddresses> <!-- サービスにアクセスする本当のアドレス --> <add baseAddress="http://localhost:8000/servicemodelsamples/service" /> </baseAddresses> </host> <endpoint address="" binding="wsHttpBinding" contract="Microsoft.Samples.HelloRoutingService.ICalculator" /> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <behaviors> <serviceBehaviors> <behavior name="CalculatorServiceBehavior"> <serviceMetadata httpGetEnabled="True"/> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> </behaviors> ルーティングサービス側の設定 <services> <!--ROUTING SERVICE --> <service behaviorConfiguration="routingData" name="System.ServiceModel.Routing.RoutingService"> <host> <baseAddresses> <!-- ルーティングサービスが動作するアドレスを定義する --> <add baseAddress="http://localhost:8000/routingservice/router"/> </baseAddresses> </host> <endpoint address="" binding="wsHttpBinding" name="reqReplyEndpoint" contract="System.ServiceModel.Routing.IRequestReplyRouter" /> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <behaviors> <serviceBehaviors> <behavior name="routingData"> <serviceMetadata httpGetEnabled="True"/> <!-- 利用するフィルターテーブルを定義する --> <routing filterTableName="routingTable1" /> </behavior> </serviceBehaviors> </behaviors> <client> <!-- ルーティングサービスに対して、ルーティングするクライアントのアドレスを定義する --> <endpoint name="CalculatorService" address="http://localhost:8000/servicemodelsamples/service" binding="wsHttpBinding" contract="*" /> </client> <!-- ルーティングサービスのメッセージフィルタを定義する --> <routing> <filters> <!-- ルーティング サービスが使用する FilterTypeを定義する。 フィルタタイプの詳細はhttp://msdn.microsoft.com/ja-jp/library/ee517424.aspxを参照してください。 --> <filter name="MatchAllFilter1" filterType="MatchAll" /> </filters> <!-- フィルターテーブルを定義する --> <filterTables> <filterTable name="routingTable1"> <add filterName="MatchAllFilter1" endpointName="CalculatorService" /> </filterTable> </filterTables> </routing> クライアント側の設定 <system.serviceModel> <client> <!-- ルーティングサービスを利用しない場合、参照するサービスのアドレス、 このアドレスは、サービス側のアドレスと一致する。 <endpoint address="http://localhost:8000/servicemodelsamples/service" binding="wsHttpBinding" contract="Microsoft.Samples.HelloRoutingService.ICalculator" />--> <!-- ルーティングサービスを参照する場合、ルーティングサービスのアドレスを参照する --> <endpoint address="http://localhost:8000/routingservice/router" binding="wsHttpBinding" contract="Microsoft.Samples.HelloRoutingService.ICalculator" /> </client> </system.serviceModel> あなたのお住まいの地域で最安のブロードバンド選び コメント: |