Bonjour
utilisant la plateforme .Net sous Visual Studio 2008 et le langage C#,
On à implémenter un web service.


Le client a intervalle de temps de 30 Seconde vérifie si le Serveur est vivant grâce à cette algorithme :

Tout d’abord on test l’ouverture des connections :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
((IClientChannel)Connection._Model).State == CommunicationState.Opened
Ensuite le client appelle une méthode defini dans l’interface exposé par le service :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Try
 
{
 
      string gid = Connection.Model.User_GetGID();                 
 
      sLogList.Add("Info " + DateTime.Now.ToString() + ":                                       
 
Success Server Response");
 
      return true;
 
}
 
 
 
catch (TimeoutException e)
 
{
 
      sLogList.Add("Error " + DateTime.Now.ToString() + ": " +                                        e.Message);
 
      return false;
 
}
 
catch (EndpointNotFoundException e)
 
{
 
      sLogList.Add("Error " + DateTime.Now.ToString() + ": " +                                        e.Message);
 
      return false
 
}
 
catch (Exception e)
 
{
 
      sLogList.Add("Error " + DateTime.Now.ToString() + ": " +                                  
 
e.Message);
 
      return false;
 
}
Voici la configuration du Serveur :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?xml version="1.0" encoding="utf-8" ?>
 
<configuration>
 
    <system.serviceModel>
 
    <services>
 
      <service name="My.Service.Model.Wcf.Model" behaviorConfiguration="My.Service.Model.Wcf.Model">
 
        <host>
 
        </host>
 
        <endpoint address=""  binding="wsHttpBinding" contract="My.Service.Model.Wcf.IModel"/>
 
      </service>
 
    </services>
 
    <behaviors>
 
      <serviceBehaviors>
 
        <behavior name="My.Service.Model.Wcf.Model">
 
          <serviceMetadata httpGetEnabled="False"/>
 
          <serviceDebug includeExceptionDetailInFaults="False" />
 
          <serviceThrottling maxConcurrentCalls="10" maxConcurrentSessions="1"/>
 
        </behavior>
 
      </serviceBehaviors>
 
    </behaviors>
 
    <bindings>
 
      <wsHttpBinding>
 
        <binding name="wsHttpBinding" 
 
                 maxBufferPoolSize="134217728"
 
                 maxReceivedMessageSize="134217728">
 
          <readerQuotas maxArrayLength="2097152"
 
                        maxDepth="1024"
 
                        maxNameTableCharCount="2097152"
 
                        maxStringContentLength="8388608"
 
                        maxBytesPerRead="524288"/>
 
        </binding>
 
      </wsHttpBinding>
 
    </bindings>
 
  </system.serviceModel>
 
</configuration>


Au bout d’un temps aléatoire variant de 5 à 10 minutes l’exception :”Server Too Busy ” est lancé.
Pourriez-vous m’apporter votre aide.
Merci