質問
私は複数のサービスの契約に定める一WCF図書館が主催の下にWindowsサービスです。これらのサービスに晒されておりますが、以下のWindowsサービスの設定ファイル:
<services>
<service behaviorConfiguration="ReportingComponentLibrary.TemplateServiceBehavior"
name="ReportingComponentLibrary.TemplateService">
<endpoint address="" binding="wsHttpBinding" contract="ReportingComponentLibrary.ITemplateService" bindingConfiguration="wsHttp" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" ></endpoint>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/ReportingComponentLibrary/TemplateService/" />
</baseAddresses>
</host>
</service>
<service behaviorConfiguration="ReportingComponentLibrary.TemplateServiceBehavior"
name="ReportingComponentLibrary.TemplateReportService">
<endpoint address="" binding="wsHttpBinding" contract="ReportingComponentLibrary.ITemplateReportService" bindingConfiguration="wsHttp" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" ></endpoint>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/ReportingComponentLibrary/TemplateReportService/" />
</baseAddresses>
</host>
</service>
</services>
この追加サービスの参考に私のクライアントアプリケーション,
することはできるだけサービスの参考に上記の二つのサービス
いので別途基準の各サービス/サービス契約になります。
更新:
この滞在を通して、私は申請してください:
私は三つの異なるプロジェクト:
- WCFサービス図書館
- Windowsサービスをホストした上で、WCFサービス
- クライアント-コンソール-アプリケーションのための試験
現在のアプリです。Configに、WCFサービス図書館は、
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsHttp" maxReceivedMessageSize="50000000" maxBufferPoolSize="50000000" messageEncoding="Mtom">
<readerQuotas maxDepth="500" maxStringContentLength="500000000" maxArrayLength="500000000"
maxBytesPerRead="500000000" maxNameTableCharCount="500000000" />
</binding>
</wsHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="ReportingComponentLibrary.TemplateServiceBehavior"
name="ReportingComponentLibrary.TemplateService">
<endpoint address="" binding="wsHttpBinding" contract="ReportingComponentLibrary.ITemplateService" bindingConfiguration="wsHttp" >
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" ></endpoint>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/ReportingComponentLibrary/TemplateService/" />
</baseAddresses>
</host>
</service>
<service behaviorConfiguration="ReportingComponentLibrary.TemplateServiceBehavior"
name="ReportingComponentLibrary.TemplateReportService">
<endpoint address="" binding="wsHttpBinding" contract="ReportingComponentLibrary.ITemplateReportService" bindingConfiguration="wsHttp" >
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/ReportingComponentLibrary/TemplateReportService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ReportingComponentLibrary.TemplateServiceBehavior">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
およびアプリです。Config Windowsサービスは前述のとおりといたしました。
現在、私のクライアントアプリケーションながらプレーする必要がありま消費する方法の両方からのTemplateServiceとTemplateReportService.
そこで、常に異なる二つのサービスの参照として
http://localhost:8080/ReportingComponentLibrary/TemplateService/ や
http://localhost:8080/ReportingComponentLibrary/TemplateReportService/
これらはすべて働きます。
が破壊も修復もおもしろくない(ほかのラッパーへの対処すが示唆されている) まさに追加する必要があり唯一の参照 呼べる方法の両方からのサービス
解決
現状では、私はこれが可能だとは思わない、あなたは2サービス参照が必要になります。あなたがサービスコードの制御を持っていると仮定すると、あなたは2つの別々のサービスを指していることにより、契約の両方を実装するサービスラッパーを作成し、回避策を実装することができます。つまり、一つのサービスの参照を持つことができるようになります。 2とは対照的に、あなたは、一つのサービスでそれらの両方をしたい理由として特に問題はありますか?
編集: このブログ記事 - Meineck.Net あなたはあなたが後にしているものを達成するために、あなたのサービスを設定する方法を示していますが、やはりそれはかなりの周りの仕事です。幸運ます。
他のヒント
一つのサービス参照=ワンサービス契約
あなたのWindowsサービスは、それ自身の契約にそれぞれ、その内部に多くのサービスを提供しています。
がありますが、その契約を実装するクラスを作成し、すべてのサービスの機能が含まれている単一の契約を作成止めるものは何もありませんが、単に他のservciesの層を通過されます。