1つのソリューションに2つのプロジェクトがあります。1つのプロジェクト(MainProjectと呼びましょう)が実行可能ファイルになります。もう1つのプロジェクトは、ControlsProjectと呼びます。これには、が含まUserControl
れ、MainProject内で参照(および使用)されます。ControlsProjectには、WCFサービスリファレンスもあります。
この構成に関して2つの質問があります。
- WCF構成をControlsProjectからMainProjectにコピーすることはできますか(「別のプロジェクトにWeb参照エンドポイント構成を含める方法」ごとにコピーできるとは思いません)
- ControlsProject構成では、コントラクトには完全修飾名前空間ではなく、'
ServiceName.IServiceInterfaceName
'などの名前があります。ControlsProjectの出力はMainProjectのbinフォルダーにあるファイルになるため、コントラクト名はどのようになりますか?
構成をコピーしようとしましたが、例外が発生しました: " Could not find default endpoint element that references contract 'MyService.IMyService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
"構成をコピーしたときに、インターフェイスの名前を。として完全に修飾しましたControlsProject.MyService.IMyService
。
あなたが提供できるどんな助けも大歓迎です!
更新 (2011年7月14日午後5時28分EST)
これが私のクライアントapp.configからのスニペットです:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IStatService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://intranet/StatService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IStatService"
contract="StatService.IStatService" name="BasicHttpBinding_IStatService" />
</client>
</system.serviceModel>
これが私のWebサービスweb.configからのスニペットです:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>