まず、svcファイルが作成されるWCFサービスアプリケーションを作成します。それから私は私の小さなサービス関連のコードを書きます。F5キーを押すと、wcfテストクライアントは正常に表示され、svcファイルを選択してブラウザオプションで表示を選択すると、すべてが正常に機能します。最初は、構成ファイルにエンドポイントが1つしかありません...つまり、wsDualHttpBindingであり、すべてが正常に機能しています。
netTcpBindingという別のエンドポイントを追加した瞬間、問題が発生します。設定ファイルにnetTcpBindingエンドポイントを追加した後、ブラウザでsvcファイルを再度参照しようとすると、プロトコル「net.tcp」というエラーメッセージが表示されます。F5キーを押すと、wcfテストクライアントにエラーメッセージが表示されます。** Cannot obtain Metadata from http://localhost:30996/ChatService.svc**
netTcpBindingを追加すると、なぜそれが発生するのかわかりません。私はどこにも私のサービスをホストしていないと言いたいことがあります。WCFサービスアプリケーションを作成し、web.configファイルにすべてのエントリを追加して、F5キーを押すだけです。これが、サービスをどこにもホストしていないためにエラーが発生する理由ですか?
これが私の設定の詳細です。
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="BBAChatService.ChatService" behaviorConfiguration="BBAChatService.ChatServiceBehavior" >
<host>
<baseAddresses>
<add baseAddress ="http://localhost:30996/ChatService.svc/"/>
<add baseAddress ="net.tcp://localhost:30997/ChatService/"/>
</baseAddresses>
</host>
<endpoint name="dual_bind"
address="dual"
binding="wsDualHttpBinding"
bindingConfiguration="WSDualHttpBinding_IChatService"
contract="BBAChatService.IChatService">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<endpoint name="tcp_bind"
address="net.tcp://localhost:30997/ChatService"
binding="netTcpBinding"
bindingConfiguration="tcpBinding"
contract="BBAChatService.IChatService">
</endpoint>
<endpoint address="net.tcp://localhost:30997/ChatService/mex"
binding="mexTcpBinding"
contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="BBAChatService.ChatServiceBehavior">
<!-- 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="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="tcpBinding"
maxBufferSize="67108864"
maxReceivedMessageSize="67108864"
maxBufferPoolSize="67108864"
transferMode="Buffered"
closeTimeout="00:00:10"
openTimeout="00:00:10"
receiveTimeout="00:20:00"
sendTimeout="00:01:00"
portSharingEnabled="true"
maxConnections="100">
<security mode="None">
</security>
<readerQuotas maxArrayLength="67108864"
maxBytesPerRead="67108864"
maxStringContentLength="67108864"/>
<reliableSession enabled="true" inactivityTimeout="00:20:00"/>
</binding>
</netTcpBinding>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IChatService"
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>
</system.serviceModel>
</configuration>
何が欠けているのか教えてください....設定ファイルで何を変更する必要がありますか。
これが私のプロジェクトソリューションエクスプローラーのスクリーンショットです。