예제 #1
0
        internal PersonPortTypeClient CreatePort()
        {
            BasicHttpBinding binding = new BasicHttpBinding();

            binding.Security.Mode = BasicHttpSecurityMode.Transport;
            binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
            binding.MaxReceivedMessageSize = Int32.MaxValue;
            binding.OpenTimeout            = new TimeSpan(0, 3, 0);
            binding.CloseTimeout           = new TimeSpan(0, 3, 0);
            binding.ReceiveTimeout         = new TimeSpan(0, 3, 0);
            binding.ReceiveTimeout         = new TimeSpan(0, 3, 0);
            binding.SendTimeout            = new TimeSpan(0, 3, 0);

            PersonPortTypeClient port = new PersonPortTypeClient(binding, StubUtil.GetEndPointAddress("Person/4"));

            port.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.My, X509FindType.FindByThumbprint, registryProperties.ClientCertThumbprint);

            // Disable revocation checking
            if (registryProperties.DisableRevocationCheck)
            {
                port.ClientCredentials.ServiceCertificate.Authentication.RevocationMode = X509RevocationMode.NoCheck;
            }

            return(port);
        }
예제 #2
0
        public static PersonPortTypeClient CreatePersonPortTypeClient(BasicHttpBinding binding, string urlServicePlatformService, X509Certificate2 certificate)
        {
            var client = new PersonPortTypeClient(binding, new EndpointAddress(urlServicePlatformService))
            {
                ClientCredentials =
                {
                    ClientCertificate =
                    {
                        Certificate   = certificate
                    }
                }
            };

            return(client);
        }
예제 #3
0
        internal PersonPortTypeClient CreatePort()
        {
            BasicHttpBinding binding = new BasicHttpBinding();

            binding.Security.Mode = BasicHttpSecurityMode.Transport;
            binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
            binding.MaxReceivedMessageSize = Int32.MaxValue;
            binding.OpenTimeout            = new TimeSpan(0, 3, 0);
            binding.CloseTimeout           = new TimeSpan(0, 3, 0);
            binding.ReceiveTimeout         = new TimeSpan(0, 3, 0);
            binding.SendTimeout            = new TimeSpan(0, 3, 0);

            PersonPortTypeClient port = new PersonPortTypeClient(binding, StubUtil.GetEndPointAddress("Person/5"));

            port.ClientCredentials.ClientCertificate.Certificate = CertificateLoader.LoadCertificateAndPrivateKeyFromFile();

            // Disable revocation checking
            if (registryProperties.DisableRevocationCheck)
            {
                port.ClientCredentials.ServiceCertificate.Authentication.RevocationMode = X509RevocationMode.NoCheck;
            }

            return(port);
        }