Wcf l'authentification de Base

Quelques soucis à l'aide de l'authentification de base avec un simple test de service Wcf. J'obtiens une exception:

Le service demandé, 'http://qld-tgower/test/Service.svc" ne peut pas être activé. Voir l' > serveur de diagnostic des journaux de suivi pour plus d'informations.

Et dans le journal de suivi, il montre:

Les schémas d'authentification est configuré sur l'hôte ("Base") ne permettent pas à ceux configurés sur la liaison "BasicHttpBinding' ("Anonyme"). Veuillez vous assurer que le SecurityMode est définie pour le Transport ou l'TransportCredentialOnly. En outre, cela peut être résolu en modifiant les schémas d'authentification pour cette application par le biais de l'outil de gestion IIS, par le biais de la ServiceHost.L'authentification.AuthenticationSchemes de la propriété, dans le fichier de configuration d'application à la <serviceAuthenticationManager> élément, par la mise à jour de la ClientCredentialType bien sur la liaison, ou en ajustant la AuthenticationScheme bien sur la HttpTransportBindingElement.

Mais ce que je ne comprends quand je nous le mauvais nom d'utilisateur et le mot de passe qu'il dit qu'il EST à l'aide de l'authentification de base?

La requête HTTP est autorisée avec le schéma d'authentification client "de Base". L'en-tête d'authentification reçues du serveur a été " Basic realm="qld-tgower"'.

C'est mon web.config détails

<system.serviceModel>
<services>
  <service name="WcfService"
      behaviorConfiguration="Behavior">
    <endpoint address="http://QLD-TGOWER/test/Service.svc"
              binding="basicHttpBinding"
              bindingConfiguration="httpBinding"
              contract="IService" />
  </service>
</services>
<diagnostics>
  <endToEndTracing activityTracing="false" messageFlowTracing="true" propagateActivity="true"></endToEndTracing>
</diagnostics>
<bindings>
  <basicHttpBinding>
    <binding name="httpBinding">
      <security mode="TransportCredentialOnly">
        <transport  clientCredentialType="Basic" proxyCredentialType="Basic">
        </transport>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>

et c'est l'une de mes applications.config

<system.serviceModel>
    <diagnostics>
      <endToEndTracing activityTracing="true" />
      <messageLogging logMessagesAtTransportLevel="true" />
    </diagnostics>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IService" >
          <security mode="TransportCredentialOnly">

            <transport clientCredentialType="Basic" proxyCredentialType="Basic"></transport>
            <message clientCredentialType="UserName" />
          </security>

        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://QLD-TGOWER/test/Service.svc" binding="basicHttpBinding"
        bindingConfiguration="BasicHttpBinding_IService" contract="ServiceReference1.IService"
        name="BasicHttpBinding_IService" />
    </client>
</system.serviceModel>

mon test de l'application

private static void Main(string[] args)
{
    var proxy = new ServiceClient("BasicHttpBinding_IService");
    var clientCredentials = proxy.ClientCredentials;
    clientCredentials.UserName.UserName = "username";
    clientCredentials.UserName.Password = "password";
    var res = proxy.GetData(1);
    Console.WriteLine(res);
    Console.WriteLine("Done");
    Console.ReadKey(true);
}

Et mon service

public class Service : IService
{

   public string GetData(int value)
   {
       return string.Format("You entered: {0}", value);
   }
}

Il y a une chose qui me manque ici?

InformationsquelleAutor TheRealTy | 2011-11-22