private DNSWebSvcClient OpenDnsServiceClient() { DNSWebSvcClient dnswebSvcClient = new DNSWebSvcClient(this.wsb, new EndpointAddress(this.endpointUrl, new AddressHeader[0])); dnswebSvcClient.ClientCredentials.ClientCertificate.Certificate = TlsCertificateInfo.FindFirstCertWithSubjectDistinguishedName(this.authorizationCertificateSubject); dnswebSvcClient.Open(); return(dnswebSvcClient); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); WebSvcDns webSvcDns = new WebSvcDns(null, ""); DNSWebSvcClient dnswebSvcClient = null; AcceptedDomain dataObject = this.DataObject; string domain = dataObject.DomainName.Domain; try { dnswebSvcClient = new DNSWebSvcClient(webSvcDns.Wsb, new EndpointAddress(this.dnsEndpoint, new AddressHeader[0])); dnswebSvcClient.ClientCredentials.ClientCertificate.Certificate = TlsCertificateInfo.FindFirstCertWithSubjectDistinguishedName(this.certificateSubject); dnswebSvcClient.Open(); if (dnswebSvcClient.IsDomainAvailable(domain)) { return; } ResourceRecord[] allResourceRecordsByDomainName = dnswebSvcClient.GetAllResourceRecordsByDomainName(domain); foreach (ResourceRecord record in allResourceRecordsByDomainName) { base.WriteObject(new WebDnsRecord(record)); } } catch (TimeoutException exception) { base.WriteError(exception, ErrorCategory.InvalidArgument, dataObject); } catch (SecurityAccessDeniedException exception2) { base.WriteError(exception2, ErrorCategory.InvalidArgument, dataObject); } catch (CommunicationException exception3) { base.WriteError(exception3, ErrorCategory.InvalidArgument, dataObject); } finally { if (dnswebSvcClient != null) { dnswebSvcClient.Close(); } } TaskLogger.LogExit(); }