WCF 構成のセットアップに関する基本的なガイダンスが必要です。これは、WCF に関する私の最初の本格的な取り組みです (そして、stackoverflow に関する最初の投稿です)。
Web プロジェクトで参照している WCF クラス ライブラリ (APILibrary) があります。wcf ライブラリには、現在 IAuthService と ITradeService の 2 つのサービスがあります。
これらに沿って、3 つの質問があります。
1)私の問題 (およびこの投稿の元の理由) は、アプリケーションをコンパイルすると、Web アプリで TradeServiceCient を呼び出すことができますが、AuthServiceClient を呼び出すことができないことです。後者は、インテリセンスには表示されません。それらが同じポートを共有している(そして含まれているエンドポイントは1つだけである)という事実に関係していると感じていますが、明らかに不明です.
2) 開発およびテスト中に、2 つのサービス エンドポイントを同時に公開しようとしています (おそらくさらにいくつか)。ステージングとホスティングに移行すると、各エンドポイントには独自のアドレスが割り当てられます。それまでは、どうすればいいですか (これは上記の質問に関連していると感じています)。
3)多くの投稿で、「クライアント」と「サーバー」の「system.serviceModel」コードの例があることに気づきました。これらの一意のファイルまたはタグは、WCF ライブラリにある App.config ファイルにありますか? それぞれ何をしているの?現在、私はサーバー側だけを持っていると思いますか?
現在、App.config ファイル (WCF ライブラリ内) にあるものは次のとおりです。
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<client />
<services>
<service behaviorConfiguration="ApiLibrary.ApiBehavior" name="SpoonSys.Api.Trade.TradeService">
<endpoint address="" binding="wsHttpBinding" contract="SpoonSys.Api.Trade.ITradeService">
<identity>
<dns value="localhost:8731" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8731/Design_Time_Addresses/ApiLibrary/Trade/" />
</baseAddresses>
</host>
</service>
<service behaviorConfiguration="ApiLibrary.ApiBehavior" name="SpoonSys.Api.Authentication.AuthService">
<endpoint address="" binding="wsHttpBinding" contract="SpoonSys.Api.Authentication.IAuthService">
<identity>
<dns value="localhost:8731" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8731/Design_Time_Addresses/ApiLibrary/Authentication/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ApiLibrary.ApiBehavior">
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="True"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
私の構成は ASP.NET / Framework 3.5 / VS 2008 / C# です