internal BrugerPortTypeClient 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); BrugerPortTypeClient port = new BrugerPortTypeClient(binding, StubUtil.GetEndPointAddress("Bruger/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); }
public static BrugerPortTypeClient CreateBrugerPortTypeClient(BasicHttpBinding binding, string urlServicePlatformService, X509Certificate2 certificate) { var client = new BrugerPortTypeClient(binding, new EndpointAddress(urlServicePlatformService)) { ClientCredentials = { ClientCertificate = { Certificate = certificate } } }; return(client); }
internal BrugerPortTypeClient 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); BrugerPortTypeClient port = new BrugerPortTypeClient(binding, StubUtil.GetEndPointAddress("Bruger/5")); port.ClientCredentials.ClientCertificate.Certificate = CertificateLoader.LoadCertificateAndPrivateKeyFromFile(); // Disable revocation checking if (registryProperties.DisableRevocationCheck) { port.ClientCredentials.ServiceCertificate.Authentication.RevocationMode = X509RevocationMode.NoCheck; } return(port); }