2

WCF で二重の ReliableSecureProfile を使用していますが、クライアントで例外が発生した場合、サーバーは新しい要求のリッスンを停止します。

単一のクライアントに発生する障害に対するサーバーの回復力を高めるにはどうすればよいですか? サーバーを再起動するか再デプロイすると、すべてが再び機能します

私のクライアントコードは次のようになります。

            CustomBinding rspBinding = new CustomBinding();
            rspBinding.Elements.Add(new ReliableSessionBindingElement());
            rspBinding.Elements.Add(new MakeConnectionBindingElement());
            rspBinding.Elements.Add(new TextMessageEncodingBindingElement());
            rspBinding.Elements.Add(new HttpTransportBindingElement());

            DuplexChannelFactory<IProcessDataDuplex> channelFactory =
                new DuplexChannelFactory<IProcessDataDuplex>
                    (new CallbackHandler(), rspBinding, serviceAddress);

            //
            // The problem always occurs on this line.
            //
            reusableSW = new LC.Utils.WCF.ServiceWrapper<IProcessDataDuplex>(channelFactory);

私の web.config は次のようになります。

   <system.serviceModel>

    <behaviors>
      <serviceBehaviors>
        <behavior name="rspServiceBehavior">
          <serviceMetadata httpGetEnabled="true" policyVersion="Policy15" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"  />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <useRequestHeadersForMetadataAddress>
            <defaultPorts>
              <add scheme="http" port="80" />
              <add scheme="https" port="443" />
            </defaultPorts>
          </useRequestHeadersForMetadataAddress>
        </behavior>
      </serviceBehaviors>



    </behaviors>
    <bindings>
      <customBinding>
        <!-- Reliable Secure Profile -->
        <binding name="rspBinding">
          <reliableSession />
          <MakeConnectionBindingElement/>
          <textMessageEncoding />
          <httpTransport />
        </binding>
      </customBinding>

      <netTcpBinding>
        <binding portSharingEnabled="true" >
          <security mode="None" />
        </binding>
      </netTcpBinding>

    </bindings>

    <extensions>
      <bindingElementExtensions>

        <!-- Reliable Secure Profile -->
        <add name="MakeConnectionBindingElement" type="Microsoft.Samples.ReliableSecureProfile.MakeConnectionElement, Microsoft.Samples.ReliableSecureProfile.MakeConnectionChannel" />

      </bindingElementExtensions>
    </extensions>

    <services>


      <!-- Reliable Secure Profile -->
      <service behaviorConfiguration="rspServiceBehavior" name="Microsoft.Samples.ReliableSecureProfile.RSPService">
        <endpoint binding="customBinding" bindingConfiguration="rspBinding"
            contract="Microsoft.Samples.ReliableSecureProfile.IProcessDataDuplex"
            listenUriMode="Explicit">
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
            contract="IMetadataExchange" />
        <host>
        </host>
      </service>

      <!--<service name="WcfTcpTest.Service1" >
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:1337/Service1/" />
          </baseAddresses>
        </host>
        <endpoint address="" binding="netTcpBinding" contract="WcfTcpTest.IService1">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
      </service>-->

    </services>
    <protocolMapping>
      <clear/>
      <!-- removes all defaults which you may or may not want. -->
      <!-- If not, use <remove scheme="http" /> -->
      <add scheme="http" binding="customBinding" bindingConfiguration="rspBinding"/>
    </protocolMapping>
    <serviceHostingEnvironment
      aspNetCompatibilityEnabled="false"

      multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
4

1 に答える 1

0

この問題はもう再現できません (サーバーが応答を停止するだけです)。この問題は、ここで説明されているように、処理された例外をキャッチしてすべてのスレッドを停止したいという VS2010 の欲求に関連していると思います。

例外が処理されていても、VS2010 デバッガーで未処理の例外を取得する

于 2011-05-31T01:20:25.323 に答える