2012-01-21 6 views
1

WCFサービスをホストするWindowsサービスがあります。私もそれに接続するクライアントがあり、メッセージは前後に送信されます。クライアントからサービスにメッセージを送信すると、クライアントは次の控除をキャッチします。WCFサービスクライアントに「サーバーは意味のある返信を提供していません...」例外

サーバーは意味のある返答をしませんでした。これは、契約の不一致、早すぎるセッションのシャットダウン、または内部サーバーのエラーによって引き起こされる可能性があります。

これは、サービスがクライアントから送信されたメッセージに直接返信することを期待していないため、少し奇妙です。サービスはメッセージを正常に取得しますが、クライアントはこの例外をスローし、サービスへの接続が失われているようです。

ここにはサービスapp.configがあります。 RESTfullサービスについてのビットを無視:

<?xml version="1.0"?> 
<configuration> 
    <system.serviceModel> 
    <services> 
     <service name="OSAERest.api" behaviorConfiguration="MyServiceBehavior"> 
     <endpoint address="http://localhost:8732/api" 
        binding="webHttpBinding" 
        contract="OSAERest.IRestService" 
        behaviorConfiguration="WebHttp"/> 
     </service> 
     <service name="WCF.WCFService" behaviorConfiguration="WCFBehavior"> 
     <endpoint address="" binding="wsDualHttpBinding" bindingConfiguration="WCFBinding" contract="WCF.IWCFService"> 
      <identity> 
      <dns value="localhost" /> 
      </identity> 
     </endpoint> 
     <endpoint 
      address="mex" 
      binding="mexHttpBinding" 
      bindingConfiguration="" 
      contract="IMetadataExchange"/> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCF/WCFService/" /> 
      </baseAddresses> 
     </host> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="MyServiceBehavior"> 
      <serviceMetadata httpGetEnabled="true"/> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
     </behavior> 
     <behavior name="WCFBehavior"> 
      <serviceMetadata httpGetEnabled="true"/> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
      <dataContractSerializer maxItemsInObjectGraph="2147483647" /> 
      <serviceTimeouts transactionTimeout="05:05:00" /> 
      <serviceThrottling maxConcurrentCalls="500" maxConcurrentSessions="500" 
      maxConcurrentInstances="2147483647" /> 
     </behavior> 
     </serviceBehaviors> 
     <endpointBehaviors> 
     <behavior name="WebHttp"> 
      <webHttp /> 
     </behavior> 
     </endpointBehaviors> 
    </behaviors> 
    <bindings> 
     <wsDualHttpBinding> 
     <binding name="WCFBinding"> 
      <security mode="None"> 
      </security> 
     </binding> 
     </wsDualHttpBinding> 

    </bindings> 
    </system.serviceModel> 
    <startup> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> 
    </startup> 
    <runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
     <probing privatePath="lib" /> 
    </assemblyBinding> 
    </runtime> 
</configuration> 

そしてここでは、クライアントのapp.configは次のとおりです。

<?xml version="1.0"?> 
<configuration> 
    <appSettings> 

    <add key="ServiceIP" value="127.0.0.1"/> 


    </appSettings> 
    <startup> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> 
    </startup> 
    <runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
     <probing privatePath="lib" /> 
    </assemblyBinding> 
    </runtime> 
    <system.serviceModel> 
    <bindings> 
     <wsDualHttpBinding> 
     <binding name="WSDualHttpBinding_IWCFService" closeTimeout="00:01:00" 
      clientBaseAddress="http://localhost:8733/Design_Time_Addresses/WCF/WCFService/" 
      openTimeout="00:00:10" receiveTimeout="00:10:00" sendTimeout="00:00:10" 
      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="None"> 
      <message clientCredentialType="Windows" negotiateServiceCredential="true" /> 
      </security> 
     </binding> 
     </wsDualHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="http://localhost:8731/Design_Time_Addresses/WCF/WCFService/" 
     binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IWCFService" 
     contract="WCFService.IWCFService" name="WSDualHttpBinding_IWCFService"> 
     <identity> 
      <dns value="localhost" /> 
     </identity> 
     </endpoint> 
    </client> 
    </system.serviceModel> 
</configuration> 

はなぜクライアントはこの例外をキャッチされましたか?

EDIT:

WCFServiceClient wcfObj; 
EndpointAddress ep = new EndpointAddress("http://localhost:8731/Design_Time_Addresses/WCF/WCFService/"); 
InstanceContext context = new InstanceContext(this); 
wcfObj = new Manager_WPF.WCFService.WCFServiceClient(context, "WSDualHttpBinding_IWCFService", ep); 
wcfObj.Subscribe(); 

wcfObj.messageHost(message); 
+0

が、これは、クライアントがサービスを呼び出すか、またはいくつかのメッセージが送られてきた(または複数のクライアントが実行されている場合)の後に毎回起こるん –

+0

1つのクライアントだけです。私は、バックグラウンドスレッドに呼び出し、コールバックを置くことによって、これを修正しました接続された。サービスにメッセージを送信するたびに発生します。 – Brian

+0

契約を表示することはできますか?サービスは要求の処理中にクライアントにコールバックしようとしますか? –

答えて

1

私はSilverlightのクライアントと二重TCPバインディングと同じ問題を抱えていました:

は、ここでそれが助け場合、私はサービスにメッセージを送信していますC#のコードです。このprobemは、wcfメソッド呼び出しから戻る前にクライアントにコールバックを呼び出すことによって発生しました。

... 
ThreadPool.QueueUserWorkItem(state => 
{     
    //this notifies service subscribers (calls registered callbacks)        
    OnConfigurationUpdated(EventArgs.Empty); 
}); 
return; 
関連する問題