Click here to Skip to main content
15,886,035 members
Articles / Web Development / ASP.NET

An easy way to use certificates for WCF security

Rate me:
Please Sign up or sign in to vote.
4.69/5 (38 votes)
30 Apr 2007MIT12 min read 476.6K   7.2K   136  
An easy solution to use certificates on Windows Communication Foundation loading the certificates from files
//------------------------------------------------------------------------------
// <auto-generated>
//     Il codice è stato generato da uno strumento.
//     Versione runtime:2.0.50727.42
//
//     Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
//     il codice viene rigenerato.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Client.MathService
{
    
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    [System.ServiceModel.ServiceContractAttribute(ConfigurationName="Client.MathService.IMathService")]
    public interface IMathService
    {
        
        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IMathService/Sum", ReplyAction="http://tempuri.org/IMathService/SumResponse")]
        double Sum(double a, double b);
    }
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public interface IMathServiceChannel : Client.MathService.IMathService, System.ServiceModel.IClientChannel
    {
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    public partial class MathServiceClient : System.ServiceModel.ClientBase<Client.MathService.IMathService>, Client.MathService.IMathService
    {
        
        public MathServiceClient()
        {
        }
        
        public MathServiceClient(string endpointConfigurationName) : 
                base(endpointConfigurationName)
        {
        }
        
        public MathServiceClient(string endpointConfigurationName, string remoteAddress) : 
                base(endpointConfigurationName, remoteAddress)
        {
        }
        
        public MathServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(endpointConfigurationName, remoteAddress)
        {
        }
        
        public MathServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(binding, remoteAddress)
        {
        }
        
        public double Sum(double a, double b)
        {
            return base.Channel.Sum(a, b);
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
Software Developer
Italy Italy
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions