private async Task SendRemoteInvokeResult(IMessageSender sender, DnsTransportMessage resultMessage) { try { if (_logger.IsEnabled(LogLevel.Debug)) { _logger.LogDebug("准备发送响应消息。"); } await sender.SendAndFlushAsync(new TransportMessage(resultMessage)); if (_logger.IsEnabled(LogLevel.Debug)) { _logger.LogDebug("响应消息发送成功。"); } } catch (Exception exception) { if (_logger.IsEnabled(LogLevel.Error)) { _logger.LogError(exception, "发送响应消息时候发生了异常。"); } } }
private async Task <DnsTransportMessage> LocalExecuteAsync(DnsServiceEntry entry, DnsTransportMessage message) { var resultMessage = new HttpResultMessage <object>(); try { var dnsQuestion = message.DnsQuestion; message.Address = await entry.Behavior.DomainResolve(dnsQuestion.Name); } catch (Exception exception) { if (_logger.IsEnabled(LogLevel.Error)) { _logger.LogError(exception, "执行本地逻辑时候发生了错误。"); } } return(message); }