Duplex Web サービスを機能させるのに問題があります。次のエラーが表示されます。
ServiceModel クライアント構成セクションで、コントラクト 'IService1' を参照する既定のエンドポイント要素が見つかりませんでした。これは、アプリケーションの構成ファイルが見つからなかったか、このコントラクトに一致するエンドポイント要素がクライアント要素に見つからなかったためである可能性があります。
これは、サービスにアクセスしようとしている単体テストによってスローされます。私は同様のSOの質問を見つけました:
WCF エラー - コントラクト 'UserService.UserService' を参照する既定のエンドポイント要素が見つかりませんでした
そして答えは「設定ファイルを他のプロジェクトにインクルードする」ということですが、これは具体的にどういう意味なのでしょうか?
- サービスを DLL にコンパイルしてインクルードしますか?
- 「system.serviceModel」またはそのサブセットに含まれるすべてをコピーしますか?
- エンドポイントと関係がありますか?
編集:構成ファイル
Web.config
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name ="svcbh">
<serviceMetadata httpGetEnabled="False"/>
<serviceDebug includeExceptionDetailInFaults="False"/>
</behavior>
</serviceBehaviors>
</behaviors>
<!--<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />-->
<services>
<service name ="Test_Duplex.Service1" behaviorConfiguration ="svcbh" >
<host>
<baseAddresses>
<add baseAddress = "http://localhost:3857/Service1.svc" />
</baseAddresses>
</host>
<endpoint name ="duplexendpoint"
address =""
binding ="wsDualHttpBinding"
contract ="Test_Duplex.IService1"/>
<endpoint name ="MetaDataTcpEndpoint"
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange"/>
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
output.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="duplexendpoint" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="Message">
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:3857/Service1.svc" binding="wsDualHttpBinding"
bindingConfiguration="duplexendpoint" contract="Test_Duplex.IService1"
name="duplexendpoint">
<identity>
<userPrincipalName value="12680@altus.local" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>