public static DescribeDomainRecordInfoResponse Unmarshall(UnmarshallerContext context) { DescribeDomainRecordInfoResponse describeDomainRecordInfoResponse = new DescribeDomainRecordInfoResponse { HttpResponse = context.HttpResponse, RequestId = context.StringValue("DescribeDomainRecordInfo.RequestId"), DomainId = context.StringValue("DescribeDomainRecordInfo.DomainId"), DomainName = context.StringValue("DescribeDomainRecordInfo.DomainName"), PunyCode = context.StringValue("DescribeDomainRecordInfo.PunyCode"), GroupId = context.StringValue("DescribeDomainRecordInfo.GroupId"), GroupName = context.StringValue("DescribeDomainRecordInfo.GroupName"), RecordId = context.StringValue("DescribeDomainRecordInfo.RecordId"), RR = context.StringValue("DescribeDomainRecordInfo.RR"), Type = context.StringValue("DescribeDomainRecordInfo.Type"), Value = context.StringValue("DescribeDomainRecordInfo.Value"), TTL = context.LongValue("DescribeDomainRecordInfo.TTL"), Priority = context.LongValue("DescribeDomainRecordInfo.Priority"), Line = context.StringValue("DescribeDomainRecordInfo.Line"), Status = context.StringValue("DescribeDomainRecordInfo.Status"), Locked = context.BooleanValue("DescribeDomainRecordInfo.Locked") }; return(describeDomainRecordInfoResponse); }
/// <summary> /// 从阿里云服务器获取域名记录信息 /// </summary> /// <returns></returns> private string getAliDnsRecordDomainIP() { clientProfile = DefaultProfile.GetProfile("cn-hangzhou", textBox_accessKeyId.Text.ToString(), textBox_accessKeySecret.Text.ToString()); client = new DefaultAcsClient(clientProfile); DescribeDomainRecordInfoRequest request = new DescribeDomainRecordInfoRequest(); request.RecordId = textBox_recordId.Text.ToString(); try { DescribeDomainRecordInfoResponse response = client.GetAcsResponse(request); string fullDomain = response.RR.ToString() + "." + response.DomainName.ToString(); if (response.Value != "0.0.0.0") { if (fullDomain != fullDomainName.Text.ToString()) { textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "阿里云DNS域名记录:" + response.RecordId + " 对应域名为:" + fullDomain + "\r\n"); textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "配置文件域名记录:" + textBox_recordId.Text.ToString() + " 对应域名为:" + fullDomainName.Text.ToString() + "\r\n"); textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "配置文件设置错误!可能原因是修改域名记录后未及时添加,已经自动修改配置文件与服务器记录一致!" + "\r\n"); fullDomainName.Text = fullDomain; cfg.SaveAppSetting("fullDomainName", fullDomain); } textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "域名:" + response.RR + "." + response.DomainName + " 已经绑定IP:" + response.Value + "\r\n"); textBox_recordId.Text = response.RecordId; globalRR.Text = response.RR; globalDomainType.Text = response.Type; globalValue.Text = response.Value; label_TTL.Text = Convert.ToString(response.TTL); label_DomainIpStatus.Text = "已绑定"; label_DomainIpStatus.ForeColor = System.Drawing.Color.FromArgb(0, 0, 0, 255); return(response.Value); } textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "获取域名绑定IP失败!" + "\r\n"); } //处理错误 catch (Exception error) { textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "getAliDnsRecordDomainIP() Exception: " + error + "\r\n"); } /* * catch (ServerException e) * { * textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "Server Exception: " + e.ErrorCode + e.ErrorMessage + "\r\n"); * } * catch (ClientException e) * { * textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "Client Exception: " + e.ErrorCode + e.ErrorMessage + "\r\n"); * }*/ label_DomainIpStatus.Text = "未绑定"; label_DomainIpStatus.ForeColor = System.Drawing.Color.FromArgb(255, 255, 0, 0); return("0.0.0.0"); }
private string getDomainIP() { DescribeDomainRecordInfoRequest request = new DescribeDomainRecordInfoRequest(); request.RecordId = recordId.Text; try { DescribeDomainRecordInfoResponse response = client.GetAcsResponse(request); return(response.Value); } //处理错误 catch (ServerException e) { MessageBox.Show("Server Exception: " + e.ErrorCode + e.ErrorMessage); return("0.0.0.0"); } catch (ClientException e) { MessageBox.Show("Client Exception: " + e.ErrorCode + e.ErrorMessage); return("0.0.0.0"); } }
public static DescribeDomainRecordInfoResponse Unmarshall(UnmarshallerContext _ctx) { DescribeDomainRecordInfoResponse describeDomainRecordInfoResponse = new DescribeDomainRecordInfoResponse(); describeDomainRecordInfoResponse.HttpResponse = _ctx.HttpResponse; describeDomainRecordInfoResponse.RequestId = _ctx.StringValue("DescribeDomainRecordInfo.RequestId"); describeDomainRecordInfoResponse.DomainId = _ctx.StringValue("DescribeDomainRecordInfo.DomainId"); describeDomainRecordInfoResponse.DomainName = _ctx.StringValue("DescribeDomainRecordInfo.DomainName"); describeDomainRecordInfoResponse.PunyCode = _ctx.StringValue("DescribeDomainRecordInfo.PunyCode"); describeDomainRecordInfoResponse.GroupId = _ctx.StringValue("DescribeDomainRecordInfo.GroupId"); describeDomainRecordInfoResponse.GroupName = _ctx.StringValue("DescribeDomainRecordInfo.GroupName"); describeDomainRecordInfoResponse.RecordId = _ctx.StringValue("DescribeDomainRecordInfo.RecordId"); describeDomainRecordInfoResponse.RR = _ctx.StringValue("DescribeDomainRecordInfo.RR"); describeDomainRecordInfoResponse.Type = _ctx.StringValue("DescribeDomainRecordInfo.Type"); describeDomainRecordInfoResponse._Value = _ctx.StringValue("DescribeDomainRecordInfo.Value"); describeDomainRecordInfoResponse.TTL = _ctx.LongValue("DescribeDomainRecordInfo.TTL"); describeDomainRecordInfoResponse.Priority = _ctx.LongValue("DescribeDomainRecordInfo.Priority"); describeDomainRecordInfoResponse.Line = _ctx.StringValue("DescribeDomainRecordInfo.Line"); describeDomainRecordInfoResponse.Status = _ctx.StringValue("DescribeDomainRecordInfo.Status"); describeDomainRecordInfoResponse.Locked = _ctx.BooleanValue("DescribeDomainRecordInfo.Locked"); return(describeDomainRecordInfoResponse); }