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

Silverlight Discussion :

Problème avec les services WCF pour Silverlight sans connexion anonyme


Sujet :

Silverlight

  1. #1
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mars 2010
    Messages
    199
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Pas de Calais (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2010
    Messages : 199
    Points : 83
    Points
    83
    Par défaut Problème avec les services WCF pour Silverlight sans connexion anonyme
    bonjour

    voilà j'essaye de mettre en place une appli silverlight 3 en utilisant des services WCF.

    du côté de mon service (qui est un site web basé sur le framework 3.5), voilà ce que j'ai dans mon service:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    [ServiceContract(Namespace = "")]
        [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
        public class MonService
    { .......
    }
        {
    dans mon web.Config, voici ce que j'ai :
    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
    <system.serviceModel>
        <behaviors>
          <serviceBehaviors>
            <behavior name="Presentation.Ihm.ServicesSilverlight.ServiceBehavior">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
        <services>
          <service behaviorConfiguration="Presentation.Ihm.ServicesSilverlight.ServiceBehavior"
            name="Presentation.Ihm.ServicesSilverlight.Service">
            <endpoint address="" binding="basicHttpBinding" contract="Presentation.Ihm.ServicesSilverlight.Service" />
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
          </service>
        </services>
      </system.serviceModel>
    j'ai également hébergé mon site sous IIS, sans connexion anonyme.. et c'est bien cela mon problème. quand je veux référencer mon service côté SIlverlight, j'ai un message d'erreur me disant d'activer les connexions anonymes, hors ce n'est pas mon but.

    je pense que qu'il y a un pb avec le <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> de mon web.config et le AspNetCompatibilityRequirementsMode.Allowed de mon service mais j'ai déjà tenté beaucoup de combinaisons et rien à faire ..

    si vous avez des idées...

  2. #2
    Inactif  
    Homme Profil pro
    Chef de projet NTIC
    Inscrit en
    Janvier 2007
    Messages
    6 604
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 63
    Localisation : France

    Informations professionnelles :
    Activité : Chef de projet NTIC

    Informations forums :
    Inscription : Janvier 2007
    Messages : 6 604
    Points : 13 314
    Points
    13 314
    Par défaut
    Je ne connais rien à SilverLight, mais, par défaut, le basicHttpBinding ne transmet pas les Credentials Windows, donc cela ne peut fonctonner qu'en mode annnyme à moins de de préciser le contraire via BasicHttpSecurityMode que tu peux positionner à, par exemple, TransportCredentialOnly.

  3. #3
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mars 2010
    Messages
    199
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Pas de Calais (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2010
    Messages : 199
    Points : 83
    Points
    83
    Par défaut
    as tu un exemple de cette mise en place stp? je comprend bien ton raisonnement, mais je ne sais pas comment mettre ça en place..

  4. #4
    Inactif  
    Homme Profil pro
    Chef de projet NTIC
    Inscrit en
    Janvier 2007
    Messages
    6 604
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 63
    Localisation : France

    Informations professionnelles :
    Activité : Chef de projet NTIC

    Informations forums :
    Inscription : Janvier 2007
    Messages : 6 604
    Points : 13 314
    Points
    13 314
    Par défaut
    Tu peux par exemple, modifier ton ServiceModel comme cela : (ajout d'un attribut binding configuration à ton noeud endpoint, faisant reference à un noeud dans le bloc "bindings" que tu ajoutes - ici l'élément quinous intéresse est le securitymode).

    C'est sans garanti, car je n'ai jamais utilisé SilverLight,mais ça marche en WCF 'standard".

    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
     
    <system.serviceModel>
    <behaviors>
    <serviceBehaviors>
    <behavior name="Presentation.Ihm.ServicesSilverlight.ServiceBehavior">
    <serviceMetadata httpGetEnabled="true" />
    <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
    </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <services>
    <service behaviorConfiguration="Presentation.Ihm.ServicesSilverlight.ServiceBehavior"
    name="Presentation.Ihm.ServicesSilverlight.Service">
    <endpoint address=""
    binding="basicHttpBinding" 
    bindingConfiguration="basicHttpBinding_config"
    contract="Presentation.Ihm.ServicesSilverlight.Service" />
    <endpoint address="mex"
    binding="mexHttpBinding"
    contract="IMetadataExchange" />
    </service>
    </services>
    <bindings>
    <!-- 
    Following is the expanded configuration section for a BasicHttpBinding.
    Each property is configured with the default value.
    See the TransportSecurity, and MessageSecurity samples in the
    Basic directory to learn how to configure these features.
    -->
    <basicHttpBinding>
    <binding name="basicHttpBinding_config"
    hostNameComparisonMode="StrongWildcard"
    receiveTimeout="00:10:00"
    sendTimeout="00:10:00"
    openTimeout="00:10:00"
    closeTimeout="00:10:00"
    maxReceivedMessageSize="65536"
    maxBufferSize="65536"
    maxBufferPoolSize="524288"
    transferMode="Buffered"
    messageEncoding="Text"
    textEncoding="utf-8"
    bypassProxyOnLocal="false"
    useDefaultWebProxy="true" >
    <security mode="TransportCredentialOnly" />
    </binding>
    </basicHttpBinding>
    </bindings>
     
    </system.serviceModel>

  5. #5
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mars 2010
    Messages
    199
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Pas de Calais (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2010
    Messages : 199
    Points : 83
    Points
    83
    Par défaut
    bon je viens d'essayer et en effet ça na marche pas, j'ai toujours cette erreur quand je veux dérouler mon service WCF côté client:
    Les paramètres de sécurité pour ce service requièrent l’authentification «*Anonymous*», mais elle n’est pas activée pour l’application IIS qui héberge ce service.
    j'ai également essayé de passer l'AspNetCompatibilityRequirementsMode de mon service à required ou notAllowed mais toujours rien ..

    je suis un peu perdu ...

  6. #6
    Membre habitué
    Profil pro
    Inscrit en
    Septembre 2008
    Messages
    121
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2008
    Messages : 121
    Points : 135
    Points
    135
    Par défaut
    Tu veux désactiver les connexions anonymes mais du coup faut préciser le type de sécurité que tu veux utiliser à mon avis :

    <security mode="TransportCredentialOnly">
    <transport clientCredentialType="Windows" />
    </security>


    Link : Preventing Anonymous Access
    D'après ce qui est dit si tu précises pas, il y a un conflit de configuration entre IIS et le service WCF.

    edit : pour s'assurer que les connexions anonymes ne soit pas possibles il faut également supprimer ceci :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    <endpoint address="mex"
    binding="mexHttpBinding"
    contract="IMetadataExchange" />

  7. #7
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mars 2010
    Messages
    199
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Pas de Calais (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2010
    Messages : 199
    Points : 83
    Points
    83
    Par défaut
    ah génial c'est tout à fait ça. Voici ce que j'ai du mettre dans le fichier de 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
      <system.serviceModel>
        <behaviors>
          <serviceBehaviors>
            <behavior name="Presentation.Ihm.ServicesSilverlight.ServiceBehavior">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
        <services>
          <service behaviorConfiguration="Presentation.Ihm.ServicesSilverlight.ServiceBehavior"
            name="Presentation.Ihm.ServicesSilverlight.Service">
            <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding_config" contract="Presentation.Ihm.ServicesSilverlight.Service" />
          </service>
        </services>
        <bindings>
          <basicHttpBinding>
            <binding name="basicHttpBinding_config">
              <security mode="TransportCredentialOnly">
                <transport clientCredentialType="Windows" />
              </security>
            </binding>
          </basicHttpBinding>
        </bindings>
      </system.serviceModel>
    en effet tout comme tu as dit il fallait configurer la sécurité et enlever le mexHttpBinding.

    merci !! je vais enfin pouvoir avancer

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

Discussions similaires

  1. Problème avec les fichiers ".frx" pour les formulaires!
    Par charly75 dans le forum Général VBA
    Réponses: 2
    Dernier message: 19/08/2009, 16h35
  2. Réponses: 1
    Dernier message: 16/08/2009, 01h57
  3. Problème déploiement et accès WCF pour Silverlight
    Par tom741 dans le forum Silverlight
    Réponses: 4
    Dernier message: 03/07/2009, 14h51
  4. Problèmes avec les Services Intenet windows(IIS)
    Par mikawell3000 dans le forum C#
    Réponses: 1
    Dernier message: 26/07/2007, 11h55
  5. Problèmes avec les services NT/Windows 2000
    Par newfsch dans le forum API, COM et SDKs
    Réponses: 3
    Dernier message: 02/03/2006, 16h49

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