Bonjour a tous,

Je suis sur la creation d'un service offrant des webservices a un client PHP. J'ai d'abord voulu configurer WCF pour mettre un binding en tcpbinding, mais devant l'impossibilite de trouver comment passer la WSDL a mon client Soap (PHP, donc), j'ai opte pour le simpleHttpBinding. Avez-vous malgre tout une idee de comment passer en TCPBinding et avoir la wsdl ?

Sinon avec un fichier de config "basique" mon service marche bien, mais des que j'ajoute une section <behaviours>, le service est instoppable, mon navigateur n'arrive plus a se connecter a l'adresse, et les logs Windows me disent ceci:
Impossible d'arrêter le service. System.ServiceModel.CommunicationObjectFaultedException: L’objet de communication System.ServiceModel.ServiceHost ne peut pas être utilisé pour la communication car il est dans l’état Faulted.
à System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
[blabla...]
Si je retourne sur une app.config sans <behaviours>, tout "remarche" (mon navigateur recupere juste une erreur 400 du serveur HTTP binde).
app.config:
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
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <services>
      <service name="WCFTestService.SayHello" behaviorConfiguration="TestServiceBehaviour">
        <endpoint
            address="http://localhost:4000/SayHello"
            binding="basicHttpBinding"
            contract="WCFTestService.IHello" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="TestServiceBehaviour">
          <serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost/SayHello?wsdl"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>
TestService.cs
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
namespace SomeSpace
{
    public partial class TestService : ServiceBase
    {
        private ServiceHost host;
 
        public TestService()
        {
            InitializeComponent();
        }
 
        protected override void OnStart(string[] args)
        {
            host = new ServiceHost(typeof(WCFTestService.SayHello));
 
            try
            {
                host.Open();
            }
            catch (Exception ex)
            {
            }
        }
 
        protected override void OnStop()
        {
            if (host.State == CommunicationState.Opened | host.State == CommunicationState.Faulted | host.State == CommunicationState.Opening)
            {
                host.Close();
            }
        }
    }
}
Contracts.cs
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
namespace WCFTestService
{
    [ServiceContract()]
    public interface IHello
    {
        [OperationContract()]
        string SayHello();
 
        [OperationContract()]
        string SayHelloTo(string name);
    }
 
 
    public class SayHello : IHello
    {
        string IHello.SayHello()
        {
            return "Hello !";
        }
 
        string IHello.SayHelloTo(string name)
        {
            return "Hello " + name + " !";
        }
    }
 
}
Quelqu'un serait-il a meme de m'aider ?

Merci d'avance