2009-09-29 10 views
0

J'ai le problème suivant. Sur ma machine, j'ai SL 3 application, qui se compose essentiellement de:Silverlight 3 + authentification de base WCF et IIS

* Client app (SL) 
* Web app (.Net 3.5) 
* Communication with the database handled by WCF 

Le site est hébergé sur mon IIS, avec l'authentification configuration suivante:

* Anonymous access: off 
* Basic authentication: on 
* Integrated Windows authentication: on 

Mes liaisons sont configurées comme suit:

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <system.serviceModel> 
     <bindings> 
      <basicHttpBinding> 
       <binding name="BasicHttpBinding_IWcfPortal" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> 
        <security mode="TransportCredentialOnly" /> 
       </binding> 
      </basicHttpBinding> 
     </bindings> 
     <client> 
      <endpoint address="http://localhost/MyApp/WCFPortal.svc" binding="basicHttpBinding" 
       bindingConfiguration="BasicHttpBinding_IWcfPortal" contract="WcfPortal.IWcfPortal" 
       name="BasicHttpBinding_IWcfPortal" /> 
     </client> 
    </system.serviceModel> 
</configuration> 

Web.config:

<authentication mode="Windows" /> 
    <identity impersonate="true" /> 

Lorsque je navigue sur mon site, un nom d'utilisateur et un mot de passe me sont demandés. Lorsque rempli correctement, je peux accéder au site mais la communication db ne fonctionne pas. Lorsque j'accède à localhost/MyApp/WcfPortal.svc, j'obtiens l'erreur suivante:

Les paramètres de sécurité pour ce service requièrent une authentification 'anonyme' mais ne sont pas activés pour l'application IIS qui héberge ce service.

J'ai essayé d'ajouter <transport clientCredentialType="Windows" /> à la sécurité dans basicHttpBinding, mais VS me donne l'avertissement "L'attribut 'clientCredentialType' n'est pas déclaré.".

Si quelqu'un peut m'aider avec cela, je serais très reconnaissant.

Répondre

1

J'ai corrigé mon problème. Avéré que je devais changer le basicHttpBinding en deux endroits: ServiceReferences.ClientConfig et Web.Config

ServiceReferences.ClientConfig:

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="BasicHttpBinding_IWcfPortal" maxBufferSize="2147483647" 
      maxReceivedMessageSize="2147483647"> 
      <security mode="TransportCredentialOnly" /> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="http://localhost/MyApp/WCFPortal.svc" binding="basicHttpBinding" 
      bindingConfiguration="BasicHttpBinding_IWcfPortal" contract="WcfPortal.IWcfPortal" 
      name="BasicHttpBinding_IWcfPortal" /> 
    </client> 
    </system.serviceModel> 
</configuration> 

Web.config:

...

<authentication mode="Windows" /> 
... 

    <bindings> 
     <basicHttpBinding> 
     <binding name="BasicHttpBinding_IWcfPortal" maxBufferSize="10000000" maxReceivedMessageSize="10000000" receiveTimeout="00:10:00" sendTimeout="00:10:00" openTimeout="00:10:00" closeTimeout="00:10:00"> 
      <security mode="TransportCredentialOnly"> 
       <transport clientCredentialType="Ntlm" /> 
      </security> 
      <readerQuotas maxBytesPerRead="10000000" maxArrayLength="10000000" maxStringContentLength="10000000"/> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
0

Malheureusement, pour héberger ce service sous IIS6, vous devez activer l'authentification anonyme.

Questions connexes