示例#1
0
        static void Main(string[] args)
        {
            //<snippet7>
            Uri serviceEndpoint = new Uri("http://localhost:6060/service");

            using (ServiceHost host = new ServiceHost(typeof(Service), serviceEndpoint))
            {
                CustomBinding binding = new CustomBinding();
                binding.Elements.Add(SecurityBindingElement.
                                     CreateMutualCertificateDuplexBindingElement(
                                         MessageSecurityVersion.WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10));
                binding.Elements.Add(new CompositeDuplexBindingElement());
                binding.Elements.Add(new OneWayBindingElement());
                binding.Elements.Add(new HttpTransportBindingElement());

                MyServiceCredentials credentials = new MyServiceCredentials();
                SetupCertificates(credentials);
                host.Description.Behaviors.Remove(typeof(ServiceCredentials));
                host.Description.Behaviors.Add(credentials);

                ServiceEndpoint endpoint = host.AddServiceEndpoint(
                    typeof(IMyService), binding, "");
                host.Open();

                Console.WriteLine("Service started, press ENTER to stop...");
                Console.ReadLine();
            }
            //</snippet7>
        }
示例#2
0
 protected MyServiceCredentials(MyServiceCredentials other)
     : base(other)
 {
     this.clientEncryptingCert  = other.clientEncryptingCert;
     this.clientSigningCert     = other.clientSigningCert;
     this.serviceEncryptingCert = other.serviceEncryptingCert;
     this.serviceSigningCert    = other.serviceSigningCert;
 }
示例#3
0
 public MyServiceCredentialsSecurityTokenManager(MyServiceCredentials credentials)
     : base(credentials)
 {
     this.credentials = credentials;
 }
示例#4
0
 protected MyServiceCredentials(MyServiceCredentials other)
     : base(other)
 {
     this.additionalCertificate = other.additionalCertificate;
 }
示例#5
0
 private static void SetupCertificates(MyServiceCredentials credentials)
 {
 }