IIS + WCF + Windows Authentication

204 views
Skip to first unread message

Walter Poch

unread,
Dec 28, 2010, 9:49:33 AM12/28/10
to altnet-...@googlegroups.com
Estimados compañeros,

Les escribo porque estoy con un problema en el trabajo que no podemos sacar adelante. Y tiene que ver con la configuración de WCF.

Nuestra solución tiene una arquitectura típica de WebServer(IIS6)->AppServer(WCF, hosteado en un servicio windows), todo corriendo en el mismo dominio. El IIS tiene usuarios anónimos deshabilitados y autenticación windows integrada habilitada.

Luego también tiene en el web.config:

<identity impersonate="true" /> y <authentication mode="Windows" />

En la web app, tomamos bien el usuario y podemos autorizar correctamente al mismo, basandonos en sus roles (usando Authorization Manager).

Ahora queremos que el app server pueda obtener dicho usuario, que el mismo se propague hasta el servicio.

Estamos usando un NetTCPBinding común con su configuración por defecto (seguridad Transport y clientCredentialType Windows). Pero cuando ponemos esta configuración en el web server, no logramos que llegue el usuario y nos da una excepción: "The service does not allow you to log on anonymously.".

Esto la web app desde Cassini (Web developer server de Visual Studio) funciona bien, llegando el usuario al servicio WCF sin problemas).


Cualquier pista, dato, condolencias son bienvenidas =)

PD: configs:

CLIENTE

      <netTcpBinding>
        <binding name="HighThroughputTcp" maxBufferPoolSize="2147483647"
          maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="32" maxStringContentLength="5242880"
            maxArrayLength="2147483646" maxBytesPerRead="4096" maxNameTableCharCount="5242880" />
          <security mode="Transport">
            <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
            <message clientCredentialType="Windows" />
          </security>
        </binding>
        <binding name="SecureTcpBinding">
          <security mode="Transport">
            <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
            <message clientCredentialType="Windows" />
          </security>
        </binding>
      </netTcpBinding>
    </bindings>

 <client>
      <endpoint address="net.tcp://server:8010/FirmasService" binding="netTcpBinding"
        bindingConfiguration="HighThroughputTcp" contract="FirmasServiceReference.IFirmasService"
        name="NetTcpBinding_IFirmasService">
        <identity>
          <servicePrincipalName value="xxxxxx/RegistroDeFirmas" />
        </identity>
      </endpoint>

      <endpoint address="net.tcp://server:8010/SoporteService" binding="netTcpBinding"
        bindingConfiguration="SecureTcpBinding" contract="SoporteServiceReference.ISoporteService" 
        name="NetTcpBinding_ISoporteService">
        <identity>
          <servicePrincipalName value="xxxxxx/RegistroDeFirmas" />
        </identity>
      </endpoint>

      <endpoint address="net.tcp://server:8010/DictamenesService"
        binding="netTcpBinding" contract="DictamenesServiceReference.IDictamenesService"
        bindingConfiguration="SecureTcpBinding" name="NetTcpBinding_IDictamenesService">
        <identity>
          <servicePrincipalName value="xxxxxx/RegistroDeFirmas" />
        </identity>
      </endpoint>
    </client>

SERVIDOR

    <bindings>
      <netTcpBinding>
        <binding name="HighThroughputTcp" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="32" maxStringContentLength="5242880" maxArrayLength="2147483646" maxBytesPerRead="4096" maxNameTableCharCount="5242880"/>
        </binding>
      </netTcpBinding>
    </bindings>

    <services>
      <service name="RegistroDeFirmas.Services.SoporteService">
        <endpoint address="net.tcp://localhost:8010/SoporteService" binding="netTcpBinding" contract="RegistroDeFirmas.Services.Contracts.ISoporteService">
          <identity>
            <servicePrincipalName value="xxxxx/RegistroDeFirmas"/>
          </identity>
        </endpoint>
        
        <endpoint address="net.tcp://localhost:8010/SoporteService/mex" binding="mexTcpBinding" contract="IMetadataExchange" />
      </service>

      <service name="RegistroDeFirmas.Services.FirmasService">
        <endpoint address="net.tcp://localhost:8010/FirmasService" binding="netTcpBinding" bindingConfiguration="HighThroughputTcp" contract="RegistroDeFirmas.Services.Contracts.IFirmasService">
          <identity>
            <servicePrincipalName value="xxxxx/RegistroDeFirmas"/>
          </identity>
        </endpoint>
        
        <endpoint address="net.tcp://localhost:8010/FirmasService/mex" binding="mexTcpBinding" contract="IMetadataExchange" />
      </service>

      <service name="RegistroDeFirmas.Services.DictamenesService">
        
        <endpoint address="net.tcp://localhost:8010/DictamenesService" binding="netTcpBinding" contract="RegistroDeFirmas.Services.Contracts.IDictamenesService">
          <identity>
            <servicePrincipalName value="xxxxxx/RegistroDeFirmas"/>
          </identity>
        </endpoint>
        
        <endpoint address="net.tcp://localhost:8010/DictamenesService/mex" binding="mexTcpBinding" contract="IMetadataExchange" />
      </service>
    </services>


--
Saludos,

Walter G. Poch
Sr. .Net Developer
--------------------------------------------
Cell: +54 (9 341) 3353273
walte...@gmail.com

Mario Dal Lago

unread,
Dec 28, 2010, 10:25:18 AM12/28/10
to altnet-...@googlegroups.com
una vez tuve un problema similar y se soluciono agregando un SpnEndpointIdentity en el adress.... no se si esto mismo se puede hacer desde archivos de configuracion


EndpointAddress address = new EndpointAddress(new Uri(urlService), new SpnEndpointIdentity("MYSERVICE/MyMachine"));


saludos

Mario Dal Lago


--- El mar 28-dic-10, Walter Poch <walte...@gmail.com> escribió:
--
Has recibido este mensaje porque estás suscrito al grupo "AltNet-Hispano" de Grupos de Google.
Para publicar una entrada en este grupo, envía un correo electrónico a altnet-...@googlegroups.com.
Para anular tu suscripción a este grupo, envía un correo electrónico a altnet-hispan...@googlegroups.com
Para tener acceso a más opciones, visita el grupo en http://groups.google.com/group/altnet-hispano?hl=es.

 

Jorge Rowies

unread,
Dec 28, 2010, 1:04:27 PM12/28/10
to altnet-...@googlegroups.com
Walter, no soy especialista en el tema así que quizás digo una pavada, pero probaste de habilitar el trace de WCF a ver si te tira información que te pueda ayudar a ver por donde viene el problema?

Yo lo tengo configurado así:

  <system.diagnostics>
    <trace autoflush="true" />
    <sources>
      <source name="System.ServiceModel"
              switchValue="Information, ActivityTracing"
              propagateActivity="true">
        <listeners>
          <add name="sdt"
              type="System.Diagnostics.XmlWriterTraceListener"
              initializeData= "WcfTrace.e2e" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>

Más info sobre el tema:
http://msdn.microsoft.com/en-us/library/ms733025%28v=VS.90%29.aspx

Saludos

2010/12/28 Walter Poch <walte...@gmail.com>
--

Walter Poch

unread,
Dec 28, 2010, 1:29:42 PM12/28/10
to altnet-...@googlegroups.com
Muchas gracias Jorge, y Mario.

Tenemos el trace habilitado, pero directamente WCF falla antes, es como cuando valida la conexión.

El última avance fue quitando <identity impersonate="true" /> del config, y cambió el error por "The server has rejected the client credentials.".

Seguiremos investigando, pero ya nos esta ganando.

Gracias por su tiempo!

Preguntón Cojonero Cabrón

unread,
Oct 3, 2018, 4:26:14 PM10/3/18
to AltNet-Hispano
Hubo solución final?
Reply all
Reply to author
Forward
0 new messages