2012-12-26 5 views
0

Je souhaite organiser une connexion sécurisée entre un client et un service WCF. Le client doit être assuré, qu'il peut faire confiance au service.Erreur de certificat Https, service WCF sur IIS

J'ai créé deux certificats pour la racine de confiance et pour les stockages personnels sur la machine locale. Je peux voir le chemin de certification correct dans le module complémentaire de certificat. Le nom commun du certificat est localhost.

J'ai ajouté la liaison pour https sur IIS.

J'ai le service avec la configuration suivante

Comportement

<behavior name="AgencyTrustedServiceBehavior"> 
     <dataContractSerializer maxItemsInObjectGraph="10000000" /> 
     <serviceMetadata httpsGetEnabled="true" policyVersion="Policy15" /> 
     <serviceDebug includeExceptionDetailInFaults="true" /> 

     <serviceCredentials> 
     <clientCertificate> 
      <authentication certificateValidationMode="None" /> 
     </clientCertificate> 

     <serviceCertificate findValue="localhost" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" /> 

     </serviceCredentials> 
    </behavior> 

Reliure

<wsHttpBinding> 
    <binding name="InternetServiceBinding" closeTimeout="00:10:00" 
      openTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="true" 
      maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" 
      messageEncoding="Mtom"> 
     <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" 
     maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> 
     <security mode="Transport"> 
     <transport clientCredentialType="None"> 
      <extendedProtectionPolicy policyEnforcement="Never" /> 
     </transport> 
     </security> 
    </binding> 
    </wsHttpBinding> 

Endpoint

<service behaviorConfiguration="AgencyTrustedServiceBehavior" name="Megatec.MasterTourService.AuthService"> 
    <endpoint address="Anonymous" 
       binding="wsHttpBinding" 
       bindingConfiguration="InternetServiceBinding" 
       name="Megatec.MasterTourService.Contracts.IAuthServiceAnonymous" 
       contract="Megatec.MasterTourService.Contracts.IAuthService"> 
    </endpoint> 
    </service> 

Mais, lorsque je tente d'accéder au service b y en utilisant WCFTestClient, il jette l'exception suivante

There was no endpoint listening at http://localhost/IISTest/AuthService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. The remote server returned an error: (404) Not Found. 

HTTP GET Error URI: http://localhost/IISTest/AuthService.svc The document at the url http://localhost/IISTest/AuthService.svc was not recognized as a known document type.The error message from each known type may help you fix the problem: 
- Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'. 
- Report from 'DISCO Document' is 'There was an error downloading 'https://dev4-10.megatec.ru/IISTest/AuthService.svc?disco'.'. 
- The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. 
- The remote certificate is invalid according to the validation procedure. 
- Report from 'http://localhost/IISTest/AuthService.svc' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'. 
- Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'. 

ce qui est faux?

+0

Pour commencer, ne devriez-vous pas utiliser https? –

+0

J'utilise https. J'ai ajouté la liaison https pour IIS (avec ce certificat), j'essaie d'accéder à https: //localhost/IISTest/AuthService.svc adresse –

Répondre

1

L'URL du client est frappant:

"http: // localhost/IIStest/AuthService"

Il devrait être

"https: // localhost/IIStest/AuthService"

+0

J'ai résolu ceci - Le client de test WCF utilise automatiquement http: // localhost/IISTest /AuthService.svc au lieu de https: //localhost/IISTest/AuthService.svc. Lorsque j'ai ajouté le service avec l'adresse https: // localhost/IISTest/AuthService, cela fonctionne. –

Questions connexes