2009-11-11 7 views
2

J'ai créé un service RESTful et implémenté l'authentification. Il accepte le nom d'utilisateur et le mot de passe, puis accorde l'accès au service demandé. Ça fonctionne bien. Maintenant, je veux utiliser SSL en plus de mon service. Pour cela j'ai créé le certificat, puis dans IIS j'ai donné les paramètres requis. Mais mon service ne fonctionne pas. J'utilise webHttpBinding.WebHttpBinding Question de sécurité

mon web.config côté service est:

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> 
<services> 
    <service behaviorConfiguration="ServiceBehavior" name="TestAPI"> 
     <host> 
     <baseAddresses> 
      <add baseAddress="https://localhost/AuthWithSSLTest/API/TestAPI.svc" /> 
     </baseAddresses> 
     </host> 
    <endpoint address="" behaviorConfiguration="RESTFriendly" bindingConfiguration="MywebHttpBinding" binding="webHttpBinding" contract="ITestAPI" > 
     </endpoint> 
     <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" /> 
    </service> 
</services> 
<client /><bindings> 
    <webHttpBinding> 
    <binding name="MywebHttpBinding"> 
     <security mode="Transport" > 
     <transport clientCredentialType="Certificate"/> 
     </security> 
    </binding> 
    </webHttpBinding>  
</bindings> 
<behaviors> 
    <endpointBehaviors> 
    <behavior name="RESTFriendly"> 
     <webHttp /> 
    </behavior> 
    </endpointBehaviors> 
    <serviceBehaviors> 
    <behavior name="ServiceBehavior"> 
     <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" /> 
     <serviceDebug includeExceptionDetailInFaults="true" /> 
     <serviceCredentials> 
     <clientCertificate> 
      <authentication revocationMode="NoCheck" /> 
     </clientCertificate> 
     <serviceCertificate findValue="CN=tempCertClient" /> 
     </serviceCredentials> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 

Et Dans mon app.config côté client Je

<system.serviceModel> 
    <behaviors> 
     <endpointBehaviors> 
      <behavior name="NewBehavior"> 
       <clientCredentials> 
        <clientCertificate findValue="CN=tempCertClient" storeLocation="LocalMachine" /> 
        <serviceCertificate> 
         <authentication certificateValidationMode="PeerTrust" revocationMode="NoCheck" /> 
        </serviceCertificate> 
       </clientCredentials> 
      </behavior> 
     </endpointBehaviors> 
    </behaviors> 
    <bindings> 
     <customBinding> 
      <binding name="WebHttpBinding_ITestAPI"> 

       <httpTransport/> 
      </binding> 
     </customBinding> 
    </bindings> 
    <client> 
     <endpoint address="https://localhost/AuthWithSSLTest/API/API.svc/TestMethod" 
      behaviorConfiguration="NewBehavior" binding="customBinding" 
      bindingConfiguration="WebHttpBinding_ITestAPI" 
      contract="TestAPI.ITestAPI" name="WebHttpBinding_ITestAPI" /> 
    </client> 
</system.serviceModel> 

Lorsque je tente d'exécuter Client, il dit schéma d'URI fourni Https est invalide, http requis.

Lorsque j'essaie d'appeler le service Web à partir de VS2008, il est également indiqué "Impossible de trouver une adresse de base correspondant au protocole https pour le point de terminaison avec liaison WebHttpBinding. Si j'essaie d'exécuter le service Web à partir d'IIS, le message "Impossible de trouver une adresse de base qui correspond au schéma http pour le noeud final avec liaison WebHttpBinding.Les schémas d'adresse de base enregistrés sont [https]".

J'ai essayé de googler et j'ai essayé toutes les choses suggérées, mais pas de problème. S'il vous plaît aidez.

Merci à l'avance, Tara Singh

+0

Salut Je voulais juste savoir si votre problème est résolu ou non . Pouvez-vous poster comment vous l'avez réparé. Merci Bhupinder – rinks

Répondre

1

Dans la configuration de votre client, essayez de changer:

<httpTransport/> 

à:

<httpsTransport/> 
+0

Cela ne fait aucune différence, Toujours coincé avec les mêmes erreurs. –

Questions connexes