2011-04-18 21 views
5

Tengo un servicio WCF simple alojado en IIS Express en Visual Studio 2010. IIS Express está configurado para usar SSL.Problema al agregar una referencia de servicio al servicio WCF alojado en IIS Express con SSL

Antes de cambiar a SSL, no tuve problemas, pero ahora no puedo actualizar agregue una referencia de servicio a mi Servicio WCF (que es simplemente un archivo svc hospedado IIS normal).

Cuando utilizo el WcfTestClient, aparece un pequeño error más útil:

Error: Cannot obtain Metadata from https://localhost:44302/Services/TrueChecksService.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455 .WS-Metadata Exchange Error URI: https://localhost:44302/Services/TrueChecksService.svc Metadata contains a reference that cannot be resolved: 'https://localhost:44302/Services/TrueChecksService.svc'. Could not establish trust relationship for the SSL/TLS secure channel with authority 'localhost:44302'. 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.HTTP GET Error URI: https://localhost:44302/Services/TrueChecksService.svc There was an error downloading 'https://localhost:44302/Services/TrueChecksService.svc'. 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.

Aquí está mi configuración en la actualidad

<system.serviceModel> 
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> 
<bindings> 
    <basicHttpBinding> 
    <binding name="MyBasicHttpBindingConfig" receiveTimeout="00:15:00" 
     sendTimeout="00:15:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> 
     <security mode="Transport" /> 
    </binding> 
    </basicHttpBinding>  
</bindings> 
<services> 
    <service name="TrueChecksService" behaviorConfiguration="TrueChecksServiceBehavior"> 
    <endpoint binding="basicHttpBinding" bindingConfiguration="MyBasicHttpBindingConfig" 
     name="TrueChecksServiceEndpoint" contract="TrueChecksAdminSL.Web.Services.ITrueChecksService" /> 
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" /> 
    </service> 
</services> 
<behaviors> 
    <serviceBehaviors> 
    <behavior name="TrueChecksServiceBehavior"> 
     <useRequestHeadersForMetadataAddress> 
     <defaultPorts> 
      <add port="44302" scheme="https"/> 
     </defaultPorts> 
     </useRequestHeadersForMetadataAddress> 
     <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/> 
     <serviceDebug includeExceptionDetailInFaults="false"/> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 

¿Es necesario escribir una costumbre validador de certificado, dado que IIS Express genera un certificado autofirmado? Intenté resolverlo sin hacer eso porque cuando implemente en IIS, el sitio se configurará con un certificado emitido por una autoridad de certificación.

Gracias por cualquier ayuda.

Respuesta

3

Navegue por la URL desde IE. Vería la advertencia de que hay un problema con el certificado de seguridad del sitio web. Siga los pasos en what-do-i-need-to-do-to-get-ie8-to-accept-a-self-signed-certificate. Cuando eso sea exitoso y pueda acceder al sitio sin recibir esa advertencia en IE, el WCFClient también podrá acceder a él.

+0

Más específicamente siguiendo estas instrucciones de esta respuesta en la publicación que ha señalado amit_g. http://stackoverflow.com/a/1412118/83658 – jpierson

Cuestiones relacionadas