ルーティングサービス

※ここで紹介するサンプルは下記のURLからダウンロードできます。
http://www.microsoft.com/en-us/download/details.aspx?id=21459

サービス側の設定

これは従来通り、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>


あなたのお住まいの地域で最安のブロードバンド選び

コメント:



(画像の文字列を入力して下さい)

トップ   編集 凍結 差分 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2019/12/02 (月) 12:44:13 (1628d)

e[NȂECir Yahoo yV LINEf[^[Ōz500~`I
z[y[W ̃NWbgJ[h COiq@COsیI COze