2011-01-10 15 views
5

Estoy intentando configurar un servicio WCF REST a través de SSL y me siguen dando:RESTO servicio WCF a través de SSL

No se pudo encontrar una dirección base que esquema de partidos https para el punto final con WebHttpBinding vinculante. Los esquemas de dirección de base registrados son [http].

¿Alguien puede echar un vistazo a mi archivo de configuración? Gracias.

<system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 
    <system.serviceModel> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="wsHttpBinding1"> 
      <security> 
      <message clientCredentialType="UserName" /> 
      </security> 
     </binding> 
     </wsHttpBinding> 
     <mexHttpsBinding> 
     <binding name="mexHttpsBinding1"/> 
     </mexHttpsBinding> 
     <webHttpBinding> 
     <binding name="webHttpBinding1"> 
      <security mode="Transport" /> 
     </binding> 
     </webHttpBinding> 
    </bindings> 
    <services> 
     <service behaviorConfiguration="serviceBehavior" name="CompanyX.WebServices.WebApi"> 
     <endpoint address="" behaviorConfiguration="WebApiBehavior" binding="webHttpBinding" 
      bindingConfiguration="webHttpBinding1" contract="CompanyX.WebServices.IWebApi"> 
      <identity> 
      <certificateReference x509FindType="FindBySubjectName" findValue="CompanyXDev" 
       isChainIncluded="false" storeName="My" storeLocation="LocalMachine" /> 
      </identity> 
     </endpoint> 
     <endpoint binding="mexHttpsBinding" bindingConfiguration="mexHttpsBinding1" 
      name="mex" contract="IMetadataExchange" /> 
     </service> 
    </services> 
    <behaviors> 
     <endpointBehaviors> 
     <behavior name="WebApiBehavior"> 
      <webHttp /> 
     </behavior> 
     </endpointBehaviors> 
     <serviceBehaviors> 
     <behavior name="serviceBehavior"> 
      <serviceMetadata httpsGetEnabled="true" httpGetBinding="" httpsGetBinding="webHttpBinding" 
      httpsGetBindingConfiguration="webHttpBinding1" /> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
      <serviceCredentials> 
      <clientCertificate> 
       <certificate findValue="CompanyXDev" x509FindType="FindBySubjectName" /> 
      </clientCertificate> 
      <serviceCertificate findValue="CompanyXDev" x509FindType="FindBySubjectName" /> 
      <userNameAuthentication userNamePasswordValidationMode="Custom" 
       customUserNamePasswordValidatorType="CompanyX.WebServices.CredentialsValidator, CompanyX.WebServices" /> 
      <peer> 
       <certificate findValue="CompanyXDev" storeLocation="LocalMachine" 
       x509FindType="FindBySubjectName" storeName="My" /> 
      </peer> 
      <issuedTokenAuthentication> 
       <knownCertificates> 
       <add findValue="CompanyXDev" storeLocation="LocalMachine" storeName="My" 
        x509FindType="FindBySubjectName" /> 
       </knownCertificates> 
      </issuedTokenAuthentication> 
      </serviceCredentials> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" 
     multipleSiteBindingsEnabled="true"/> 
    </system.serviceModel> 
<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 

</configuration> 
+5

Parece que tiene poco más de configurado el host de servicio, ¿verdad ? –

+0

Ladislav Mrnka comentario me hizo reír, +1. – Anders

+0

Mira, otra pobre alma persiguiendo esa noción mítica de un servicio que es a la vez RESTful y RPC. –

Respuesta

3

es necesario agregar un enlace HTTPS en IIS.

  1. Vaya a su sitio en IIS
  2. Haga clic en 'Enlaces ...' en el panel de acciones a la derecha.
  3. Haga clic en 'Agregar'
  4. Seleccione 'https' y seleccione un certificado.
5

Déjame adivinar: Estás ejecutando tu servicio desde Visual Studio en el servidor web Developement (Cassini), ¿no? El servidor web de desarrollo no es compatible con HTTPS. Debe alojar su servicio en IIS y seguir los consejos de Greg para agregar enlaces HTTPS para el sitio.

2

dos opciones:

  1. especificar la dirección completa en los puntos finales.

  2. Especificar en algún lugar de la etiqueta de las direcciones de base utilizados para el anfitrión, por ejemplo:

<host> 
    <baseAddresses> 
    <add baseAddress="http://localhost:8000/service"/> 
    <add baseAddress="https://localhost:8001/service"/> 
    </baseAddresses> 
</host> 
Cuestiones relacionadas