2010-12-10 17 views
5

Me gustaría utilizar el servicio WCF alojado en IIS (5/6) con autenticación de Windows integrada habilitada y acceso anónimo deshabilitado. Intenté hacer esto siguiendo http://msdn.microsoft.com/en-us/library/ff648431.aspx, pero no obtengo un certificado de error que dice que no está instalado. Pero no necesito SSL. No tengo clientes que esperen servicios ASMX antiguos, así que no necesito usar basicHttpBinding (y tampoco es seguro), así que traté de usar wsHttpBinding.hosting servicio WCF en IIS con autenticación de Windows y sin acceso anónimo

¿Cómo obtengo wsHttpBinding con la autenticación de Windows para que funcione sin SSL? Este es un requisito tan común, pero no pude encontrar ninguna solución para esto. ¿Alguien puede publicar la configuración para el cliente y el servidor por favor? Estoy usando un cliente ASP.NET.

Mi configuración a continuación. y el mensaje de error exacto es: Se ha producido

un error al realizar la consulta HTTP para https://mymachine/WCFTest/Service1.svc. Esto podría deberse al hecho de que que el certificado del servidor no está configurado correctamente con HTTP.SYS en el caso HTTPS. Esto también podría deberse a una falta de coincidencia del enlace de seguridad entre el cliente y el servidor.

Utilicé la utilidad "svcUtil" para generar la clase de proxy y la configuración para el cliente.

server: 
    <system.serviceModel> 
     <bindings> 
      <wsHttpBinding> 
       <binding name="wsHttpEndpointBinding"> 
        <security mode="Transport"/> 
       </binding> 
      </wsHttpBinding> 
     </bindings> 
     <services> 
      <service behaviorConfiguration="WCFTest.Service1Behavior" name="WCFTest.Service1"> 
       <endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsHttpEndpointBinding" name="wsHttpEndpoint" contract="WCFTest.IService1"/> 
      </service> 
     </services> 
     <behaviors> 
      <serviceBehaviors> 
       <behavior name="WCFTest.Service1Behavior"> 
        <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
        <serviceMetadata httpGetEnabled="true"/> 
        <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
        <serviceDebug includeExceptionDetailInFaults="false"/> 
       </behavior> 
      </serviceBehaviors> 
     </behaviors> 
    </system.serviceModel> 

client: 
    <system.serviceModel> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="wsHttpEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00" 
      receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" 
      transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
      maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 
      messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 
      allowCookies="false"> 
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
       maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
      <reliableSession ordered="true" inactivityTimeout="00:10:00" 
       enabled="false" /> 
      <security mode="Transport"> 
      <transport clientCredentialType="Windows" proxyCredentialType="None" 
       realm="" /> 
      <message clientCredentialType="Windows" negotiateServiceCredential="true" 
       establishSecurityContext="true" /> 
      </security> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="https://mymachine/WCFTest/Service1.svc" 
      binding="wsHttpBinding" bindingConfiguration="wsHttpEndpoint" 
      contract="IService1" name="wsHttpEndpoint"> 
     <identity> 
      <userPrincipalName value="mymachine\ASPNET" /> 
     </identity> 
     </endpoint> 
    </client> 
    </system.serviceModel> 
+0

Publique su encuadernación (servidor/cliente) y el error exacto. No necesita SSL para la autenticación de Windows. – Aliostad

+0

Su enlace indica que desea usar Seguridad de transporte. No soy 100% positivo, pero creo que la seguridad del transporte significa lo mismo que SSL. –

+0

, como dice el título de esta pregunta, todo lo que quiero es que aloje el servicio WCF en IIS con autenticación de Windows y sin acceso anónimo, ¿qué cambios debo hacer? @Aliostad sugirió algunos cambios, ¿pero todavía no funciona y sus comentarios han sido eliminados? – RKP

Respuesta

6

Terminé usando basicHttpBinding como se explica en el artículo de http://msdn.microsoft.com/en-us/library/ff648505.aspx. publicando la configuración para el cliente y el servidor a continuación si alguien está interesado. la configuración del cliente se genera usando "svcutil".

server config:  
    <system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="BasicHttpEndpointBinding"> 
      <security mode="TransportCredentialOnly"> 
      <transport clientCredentialType="Windows" /> 
      </security> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <services> 
     <service behaviorConfiguration="WCFTest.Service1Behavior" name="WCFTest.Service1"> 
     <endpoint address="" binding="basicHttpBinding" 
      bindingConfiguration="BasicHttpEndpointBinding" 
      name="BasicHttpEndpoint" contract="WCFTest.IService1"> 
     </endpoint> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="WCFTest.Service1Behavior"> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
      <serviceMetadata httpGetEnabled="true"/> 
      <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="false"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 

client config: 
    <system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="BasicHttpEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00" 
      receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" 
      bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
      maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
      useDefaultWebProxy="true"> 
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
       maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
      <security mode="TransportCredentialOnly"> 
      <transport clientCredentialType="Windows" proxyCredentialType="None" 
       realm="" /> 
      <message clientCredentialType="UserName" algorithmSuite="Default" /> 
      </security> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="http://machinename/WCFTest/Service1.svc" 
      binding="basicHttpBinding" bindingConfiguration="BasicHttpEndpoint" 
      contract="IService1" name="BasicHttpEndpoint" /> 
    </client> 
    </system.serviceModel> 
Cuestiones relacionadas