IISに一つのサービスで複数のBindingを提供 ここでは、BasicHttpBinding と NetTcpBinding を例を挙げて説明します。 メタデータを取得するための MEX プロトコルエンドポイントに mexTcpBinding のみ、設定します、mexHttpBinding の設定が要りません。 <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" /> メタデータ取得可能のため、下記のように、メタデータの取得に設定する必要があります。 <serviceMetadata httpGetEnabled="true"/> 例: <system.serviceModel> <bindings> <basicHttpBinding> <binding name="basicHttpBindingNoSecurity"> <security mode="None" /> </binding> </basicHttpBinding> <netTcpBinding> <binding name="tcpBindingNoSecurity"> <security mode="None" /> </binding> </netTcpBinding> </bindings> <services> <service name="Samples1.MyService" behaviorConfiguration="MyServiceBehavior"> <endpoint address="" binding="basicHttpBinding" contract="Samples1.IMyService" bindingConfiguration="basicHttpBindingNoSecurity"/> <endpoint address="" binding="netTcpBinding" contract="Samples1.IMyService" bindingConfiguration="tcpBindingNoSecurity" /> <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" /> <host> <baseAddresses> <add baseAddress="http://localhost/Services1.svc"/> <add baseAddress="net.tcp://localhost:4505/Services1.svc"/> </baseAddresses> </host> </service> </services> <behaviors> <serviceBehaviors> <behavior name="MyServiceBehavior"> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> 以上でブラウザで「http://localhost/Services1.svc」を入力すると、下記のようなクライアントサービス呼び出すためのヘルプが表示され、サービスが正常に作成されました。 svcutil.exe http://localhost/Services1.svc?wsdl 「http://localhost/Services1.svc」アドレスを使って、Visual Studio の「サービス参照の追加」機能または svcutil.exe ツールによって、サービスのプロキシを生成します。生成された XXX.config ファイルの中身を確認します。 svcutil.exe ツールを利用する場合、パラメータの設定がなかったら、output.config ファイルにサービスの設定を書き込みます。 Visual Studio の「サービス参照の追加」機能を利用する場合。
反映されたサービスの設定に、二つの異なるバインディングを利用しているエンドポイントが存在していること確認できたら、問題ありません。 ★月額105円~/容量最大30GB/機能満載! ロリポップ!レンタルサーバー ★ コメント: |