0

私のアプリケーションには、1 つのサービス (システムとして実行) と 1 つのクライアント (ユーザー空間で実行) というコンポーネントが必要です。どちらも WFC (localhost) を使用して通信しており、休止状態にしてマシンを再開するまで、通信は正常に機能します。その瞬間から、私がハートビートとして使用しているメソッドは、次の内容でタイムアウト例外をスローしています

00:01:00 の割り当てられたタイムアウト内にメッセージを転送できませんでした。信頼できるチャネルの転送ウィンドウに使用できるスペースがありませんでした。この操作に割り当てられた時間は、より長いタイムアウトの一部であった可能性があります。

接続ステータスを確認していますが、問題はありません。幸いなことに、接続で「非アクティブ」が 10 分間続いた後、別のタイムアウト (10 分) が切れて、接続ステータスが Faulted に変わります。その瞬間、クライアントは新しいステータスを検出し、接続を再開できます。

私のサーバーには次の構成があります。

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
    </startup>
  <system.serviceModel>
    <bindings>
      <wsDualHttpBinding>
        <binding openTimeout="00:00:05"
                 closeTimeout="00:00:05"
                 sendTimeout="00:00:03"
                 receiveTimeout="00:01:00">
          <security mode="Message" >
            <message clientCredentialType="Windows"/>
          </security>
        </binding>
      </wsDualHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service name="EEAS.Kiosk.WcfService">
        <endpoint address="" binding="wsDualHttpBinding" contract="EEAS.Kiosk.IWcfService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8733/KioskService/WcfService/" />
          </baseAddresses>
        </host>
      </service>
    </services>
  </system.serviceModel>
</configuration>

そして私のクライアントには次の設定があります:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
    </startup>
    <system.serviceModel>
        <bindings>
            <wsDualHttpBinding>
                <binding name="WSDualHttpBinding_IWcfService" />
            </wsDualHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:8733/KioskService/WcfService/"
                binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IWcfService"
                contract="KioskWcf.IWcfService" name="WSDualHttpBinding_IWcfService">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
</configuration>

私のサービスインターフェース

  [ServiceContract(CallbackContract = typeof(IWcfServiceCallback))]

    public interface IWcfService
    {
        [OperationContract]
        void OpenSession();

        [OperationContract]
        CompositeType OpenSessionWithMessage();

        [OperationContract]
        bool isAlive();

        [OperationContract]
        void TemporarySuspension();
    }

およびコールバック インターフェイス

    public interface IWcfServiceCallback
    {
        [OperationContract]
        bool IsAlive();

        [OperationContract]
        void SuspensionFinished();

        [OperationContract]
        bool UIMessageOnCallback(CompositeType UIMessage);
    }

何か案が?私の唯一の解決策は、10 分のタイムアウトを最小限に抑えて、障害のある接続をすばやく検出して再起動することです。完璧にはほど遠い:/

4

1 に答える 1