예제 #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
파일: source.cs 프로젝트: ruo2012/samples-1
 public MyServiceCredentialsSecurityTokenManager(MyServiceCredentials credentials)
     : base(credentials)
 {
     this.credentials = credentials;
 }
예제 #4
0
파일: source.cs 프로젝트: ruo2012/samples-1
 protected MyServiceCredentials(MyServiceCredentials other)
     : base(other)
 {
     this.additionalCertificate = other.additionalCertificate;
 }
예제 #5
0
 private static void SetupCertificates(MyServiceCredentials credentials)
 {
 }