WSDualHttpBinding pour un Chat
Bonjour ,
après avoir suivi le tutoriel sur Chatez avec wcf ( de Floran Casabianca 12/13/2008), j'ai décidé de l'intégrer à une application
qui se décompose déjà en deux parties: une partie cliente appelée ClientAmaris et une partie webService appelé Simba. J'ai décidé
donc d'intéger les classes et les contrats (Ichat,etc.) et de modifier les app config. Comme le webService est hébergé dans IIS, j'
ai compris qu'il me fallait utiliser la WSDualHttpBinding à la place du NetTCPBinding. Problème je n'arrive pas à bien comprendre les configuration et
au premier appel de la fonction j'ai le message suivant
voila mon code:
Dans le client
Code:
1 2 3 4 5 6 7 8 9 10 11
|
<wsDualHttpBinding>
<binding name="WSHttpBinding_ICHat" clientBaseAddress ="http://srvamaris.grd.local:80/AmarisClient_V404/">
</binding>
</wsDualHttpBinding>
<client>
<endpoint address="http://srvamaris.grd.local/ChatServices/ChatWCF/"
binding="wsDualHttpBinding" bindingConfiguration="WSHttpBinding_ICHat"
contract="ChatContrats.IChatWCF"
name="configClient" />
</client> |
Dans le web service(webCOnfig):
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
<service behaviorConfiguration="ChatServices.ChatWCFBehavior"
name="ChatServices.ChatWCF">
<endpoint address="ChatWCF"
binding="wsDualHttpBinding"
contract="ChatContrats.IChatWCF">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://srvamaris.grd.local:80/Design_Time_Addresses/ChatServices/" />
<add baseAddress="http://srvamaris.grd.local:80/ChatServices/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ChatServices.ChatWCFBehavior">
<serviceMetadata httpGetEnabled="true" />
<!-- mettre Ã* true pour la phase de tests seulement -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior> |
dans la class d'initialisation
Code:
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
|
void IServiceAmaris.initService()
{
//démarrage du service chat
hote = new ServiceHost(typeof(ChatServices.ChatWCF));
hote.Open();
}
dans la classe de contrat
[ServiceContract(Namespace = "http://www.developpez.com/chatWCF/2008/01",
Name = "ChatDVP",
CallbackContract = typeof(IChatWCFRappel),
SessionMode = SessionMode.Required)]
public interface IChatWCF
{
[OperationContract(IsInitiating = true, IsTerminating = false, IsOneWay = true)]
void DemarrerSession(String pseudo);
[OperationContract(IsInitiating = false, IsTerminating = true, IsOneWay = true)]
void FermerSession();
[OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = true)]
void EnvoyerMessage(String message);
[OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = true)]
void Test();
} |
Je précise que cela plante lorsque je la lance en mode debug, je ne l'ai pas installé sur mon poste. A l'avenir
le client et le webservice ne serons pas installé sur le même ordinateur.
Merci de toute aide!!!!