J'ai accompagné mon WCF en utilisant IIS 7.0, l'URL est:Ajouter une référence de service n'a pas
https://example.com/CustPortal/CustomerService.svc
quand j'ajouter une référence de service dans VS2008, a obtenu cette erreur:
The document at the url https://example.com/CustPortal/CustomerService.svc was not recognized as a known document type.
The error message from each known type may help you fix the problem:
- Report from 'DISCO Document' is 'There was an error downloading 'https://el-cust-port01/CustPortal/CustomerService.svc?disco'.'.
- Unable to connect to the remote server
- No connection could be made because the target machine actively refused it 59.37.71.86:443
- Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.
- Report from 'https://193.91.152.191/CustPortal/CustomerService.svc' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.
- Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.
Metadata contains a reference that cannot be resolved: 'https://193.91.152.191/CustPortal/CustomerService.svc'.
Metadata contains a reference that cannot be resolved: 'https://193.91.152.191/CustPortal/CustomerService.svc'.
If the service is defined in the current solution, try building the solution and adding the service reference again.
Mon web.config est-
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="metadataBehavior">
<serviceMetadata httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceCredentials>
<serviceCertificate storeName="My" x509FindType="FindBySubjectName" findValue="TESTCERT" storeLocation="LocalMachine"/>
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="metadataBehavior" name="EV.Services.CustomerService">
<endpoint binding="wsHttpBinding" bindingConfiguration="wsHttpBindingConfig" contract="EV.Contracts.ICustomer" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="wsHttpBindingConfig">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
salut rallye, vous êtes super-homme, ça marche pour moi utilisé votre code. mais j'ai un autre problème lorsque j'appelle la méthode: Impossible d'établir une relation d'approbation pour le canal sécurisé SSL/TLS avec l'autorité '193.91.152.191'. – GBK
j'ai cherché et obtenu une solution en utilisant le code ci-dessous: 'ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback (OnValidationCallback),' ' bool public static OnValidationCallback (expéditeur d'objet, X509Certificate cert, chaîne X509Chain, erreurs SslPolicyErrors) { return true; } ' – GBK
Vous pouvez trouver une liste de tous les changements nécessaires pour faire fonctionner un service wcf sur https ici. On dirait que c'était le seul qui vous manquait. https://www.codeproject.com/Articles/36705/simple-steps-to-enable-HTTPS-on-WCF-WsHttp-bindi –