Elemento <message> de <basicHttpBinding>
Obtiene la configuración de seguridad del nivel del mensaje para un enlace <<basicHttpBinding>>.
<<system.serviceModel>>
<enlaces>
<<basicHttpBinding>>
<enlace>
Elemento <security> de <basicHttpBinding>
Elemento <message> de <basicHttpBinding>
<message
algorithmSuite="Basic128/Basic192/Basic256/Basic128Rsa15/Basic256Rsa15/TripleDes/TripleDesRsa15/Basic128Sha256/Basic192Sha256/TripleDesSha256/Basic128Sha256Rsa15/Basic192Sha256Rsa15/Basic256Sha256Rsa15/TripleDesSha256Rsa15"
clientCredentialType="UserName/Certificate"/>
Atributos y elementos
Atributos
Atributo | Descripción |
---|---|
algorithmSuite |
Establece el cifrado de mensajes y los algoritmos de encapsulado de claves. Este atributo es de tipo SecurityAlgorithmSuite, que especifica los algoritmos y los tamaños clave. Estos algoritmos se asignan a los indicados en la especificación Lenguaje de directiva de seguridad (WS-SecurityPolicy). El valor predeterminado es Basic286. |
clientCredentialType |
Especifica el tipo de credenciales que se van a usar al realizar la autenticación del cliente mediante seguridad basada en mensaje. El valor predeterminado es UserName. |
Elementos secundarios
None
Elementos primarios
Elemento | Descripción |
---|---|
Define las funciones de seguridad para <<basicHttpBinding>>. |
Ejemplo
Este ejemplo muestra cómo implementar una aplicación que utiliza basicHttpBinding y modo de seguridad. En el ejemplo de configuración de un servicio siguiente, la definición de extremo especifica basicHttpBinding y hace referencia a una configuración de enlace denominada Binding1. El certificado que el servicio utiliza para autenticarse al cliente se establece en la sección behaviors del archivo de configuración bajo el elemento serviceCredentials. El modo de la validación que se aplica al certificado que el cliente utiliza para autenticarse al servicio también se establece en la sección behaviors bajo el elemento clientCertificate.
El mismo enlace y detalles de seguridad se especifican en el archivo de configuración del cliente.
<system.serviceModel>
<services>
<service name="Microsoft.ServiceModel.Samples.CalculatorService"
behaviorConfiguration="CalculatorServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="https://localhost:8000/ServiceModelSamples/service"/>
</baseAddresses>
</host>
<!-- this endpoint is exposed at the base address provided by host: https://localhost:8000/ServiceModelSamples/service -->
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="Binding1"
contract="Microsoft.ServiceModel.Samples.ICalculator" />
<!-- the mex endpoint is exposed at https://localhost:8000/ServiceModelSamples/service/mex -->
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<bindings>
<basicHttpBinding>
<!--
This configuration defines the SecurityMode as Message and
the clientCredentialType as Certificate.
-->
<binding name="Binding1" >
<security mode = "Message">
<message clientCredentialType="Certificate"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<!--For debugging purposes set the includeExceptionDetailInFaults attribute to true-->
<behaviors>
<serviceBehaviors>
<behavior name="CalculatorServiceBehavior">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
<!--
The serviceCredentials behavior allows one to define a service certificate.
A service certificate is used by a client to authenticate the service and provide message protection.
This configuration references the "localhost" certificate installed during the setup instructions.
-->
<serviceCredentials>
<serviceCertificate findValue="localhost" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" />
<clientCertificate>
<!--
Setting the certificateValidationMode to PeerOrChainTrust means that if the certificate
is in the user's Trusted People store, then it will be trusted without performing a
validation of the certificate's issuer chain. This setting is used here for convenience so that the
sample can be run without having to have certificates issued by a certificate authority (CA).
This setting is less secure than the default, ChainTrust. The security implications of this
setting should be carefully considered before using PeerOrChainTrust in production code.
-->
<authentication certificateValidationMode="PeerOrChainTrust" />
</clientCertificate>
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Consulte también
Referencia
BasicHttpMessageSecurity
Message
Message
BasicHttpMessageSecurityElement
Conceptos
Otros recursos
Securing Services and Clients
Windows Communication Foundation Bindings
Configuring System-Provided Bindings
Using Bindings to Configure Services and Clients