WCF Message Security Samples
This page provides ready‑to‑run samples that demonstrate how to secure WCF messages using the .NET Framework 3.5. The examples cover:
- Message encryption and signing
- Custom security tokens
- Configuring security via
app.config - Programmatic security setup
Overview
Sample Code
Download
The MessageSecuritySample project contains a simple WCF service that uses Message security with an IssuedToken. The client authenticates using a custom X.509 certificate.
Key configuration highlights:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="SecureBinding">
<security mode="Message">
<message clientCredentialType="Certificate"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="Samples.WcfMessageSecurity.Service">
<endpoint address="" binding="wsHttpBinding"
bindingConfiguration="SecureBinding"
contract="Samples.WcfMessageSecurity.IService"/>
</service>
</services>
</system.serviceModel>