WCF Service Binding usando allowInsecureTransport = true causas de servicio de actualización de referencia en el cliente a fallar

StackOverflow https://stackoverflow.com/questions/3743288

Pregunta

Esta es mi configuración del servicio en web.config:

<binding name="statefulSessionWithUsernameOverTransport">
  <security authenticationMode="SecureConversation"
    requireSecurityContextCancellation="False" allowInsecureTransport="True">
    <secureConversationBootstrap authenticationMode="UserNameOverTransport"/>
  </security>
  <binaryMessageEncoding />
  <httpTransport />
</binding>

<service name="com.example.FooService"
  behaviorConfiguration="usernamePasswordAuthBehavior">
  <endpoint contract="com.example.FooService.IFooService"
    address="custom" binding="customBinding"
    bindingConfiguration="statefulSessionWithUsernameOverTransport" />
</service>

Estoy instalando allowInsecureTransport = true porque en el Servicio de Producción va a correr detrás de un balanceador de carga SSL de terminación. Al llamar al servicio de mis obras cliente .NET 4.0 sin ningún problema, pero tratando de actualizar la referencia de servicio en VS2010 siempre resulta en un error:

System.ServiceModel.Channels.TransportSecurityBindingElement Error: Exportación Política de Seguridad fallado. La unión contiene una TransportSecurityBindingElement pero ningún elemento de unión a la seguridad del transporte que implementa ITransportTokenAssertionProvider. No se admite la exportación política de exportación como una política. *

Yo entiendo lo que está tratando de decirme - que es básicamente lo que he desactivado la seguridad del transporte en una unión que se requiere para evitar comprometer las credenciales que viajan a través del cable. Pero - que es el punto entero de allowInsecureTransport . Podría ser que el generador de proxy no es simplemente consciente de este atributo?

Actualización:

Parece que el generador WSDL es de hecho incapaz de lidiar con el atributo. Tenía que volver a Mensaje de nivel de seguridad y un certificado autofirmado para el desarrollo. El uso de mensajes de Seguridad tenía la ventaja de ser capaz de pegarse a la Cassini para el Desarrollo en vez de ir IIS completo soplado.

<wsHttpBinding>
    <binding name="wshttpDevelopmentBinding">
      <security mode="Message">
        <message clientCredentialType="UserName" />
      </security>
    </binding>
</wsHttpBinding>
¿Fue útil?

Solución

I ran into this same issue. The problem seems to be the http transport because it doesn't implement the ITransportTokenAssertionProvider interface, but https does. I was able to get around this two ways: switch my custom binding to use https transport, which implements the interface, and add enableUnsecuredResponse="true" to the security element in the config, or write a custom binding deriving from HttpTransportBindingElement but implementing the necessary interface.

Otros consejos

I read about this few times (for example here or here) but I have never tryed it. It looks like a bug in WSDL export because when you configure service and client manually it should work but metadata export doesn't work. Second link propose some workaround but it is the ugly one.

My proposal is to develop with allowInsecureTransport set to false and HTTPS with test certificate and switch this configuration when you deploy the application (can be part of installation package).

I ran into a similar issue. I installed hot fix for .NET framework 3.5 on the client machines, and it worked after that.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top