IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C# Discussion :

Appel à un Service Windows


Sujet :

C#

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    19
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2006
    Messages : 19
    Par défaut Appel à un Service Windows
    Bonjour,

    J'ai un service avec une interface.

    J'ai commencé par le généré en Webservice et cela a fonctionné.

    Ensuite j'ai voulu l'installer en tant que service windows. J'ai utiliser le même 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
    21
    22
    23
    24
    25
    26
    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <system.serviceModel>
         <services>
          <service behaviorConfiguration="ImportServiceBehaviour" name="DataImport.ImportEngine.Importer">
            <endpoint address="" binding="wsHttpBinding" name="ImportService" 
              contract="DataImport.ImportEngine.IImporter" />
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add baseAddress="http://mon_ip:7501/ImportService" />
              </baseAddresses>
            </host>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="ImportServiceBehaviour">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <client />
      </system.serviceModel>
    </configuration>
    Coté client, le app config est le suivant (il n'a pas changé entre le webservice et le service windows) : [EDIT : j'avais posté le mauvais app.config. voici le bon app.config du client]

    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
    <system.serviceModel>
        <diagnostics>
          <messageLogging logMalformedMessages="true" logMessagesAtServiceLevel="true"
            logMessagesAtTransportLevel="true" logEntireMessage="true"/>
        </diagnostics>
        <bindings>
          <wsHttpBinding>
            <binding name="wsHttpBindingConf" closeTimeout="00:01:00" openTimeout="00:01:00"
                     receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false"
                     transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                     maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
                     messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                     allowCookies="false">
              <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
                            maxArrayLength="2147483647" maxBytesPerRead="2147483647"
                            maxNameTableCharCount="2147483647" />
              <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
              <security mode="None">
                <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
                <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default"
                         establishSecurityContext="true" />
              </security>
            </binding>
          </wsHttpBinding>
        </bindings>
        <client>
          <endpoint address="http://mon_ip:7501/ImportService"
            binding="wsHttpBinding" bindingConfiguration="wsHttpBindingConf"
            contract="ImportService.IImporter" name="ImportService">
            <identity>
              <dns value="localhost" />
            </identity>
          </endpoint>
        </client>

    Mon problème est le suivant. Mon client arrive parfaitement a acceder au Webservice. Mais lorsque que j'appelle une méthode du Service windows, j'ai l'erreur suivante :

    The message could not be processed. This is most likely because the action 'http://tempuri.org/IImporter/GetListSchema' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding.

    Merci par avance.

  2. #2
    Membre averti
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    19
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2006
    Messages : 19
    Par défaut
    J'ai réglé mon problème : En ajoutant le partie Binding pour configurer wsHttpBinding et désactiver la sécurité.

    Si vous avez d'autre solution je suis preneur, mais la sécurité n'étant pas une contrainte, j'ai applique celle ci.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. appel des fonctions d'un Service windows en C#
    Par samwac dans le forum Windows Communication Foundation
    Réponses: 13
    Dernier message: 05/02/2009, 15h03
  2. Appel de service windows
    Par Invité dans le forum ActionScript 3
    Réponses: 0
    Dernier message: 20/05/2008, 16h05
  3. [WCF] Appel d'un service windows WCF à partir de Php
    Par Interdit dans le forum Windows Communication Foundation
    Réponses: 10
    Dernier message: 21/04/2008, 10h18
  4. Réponses: 3
    Dernier message: 21/11/2006, 22h05
  5. Appeler un service Windows
    Par maveric dans le forum Applications et environnements graphiques
    Réponses: 1
    Dernier message: 01/06/2006, 16h00

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo