diff --git a/samples/Apache.IoTDB.Samples/Dockerfile b/samples/Apache.IoTDB.Samples/Dockerfile index 52b2dcf..be99440 100644 --- a/samples/Apache.IoTDB.Samples/Dockerfile +++ b/samples/Apache.IoTDB.Samples/Dockerfile @@ -17,7 +17,7 @@ #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. -FROM mcr.microsoft.com/dotnet/runtime:9.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base WORKDIR /app FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build diff --git a/src/Apache.IoTDB/Apache.IoTDB.csproj b/src/Apache.IoTDB/Apache.IoTDB.csproj index 4096948..dc01c44 100644 --- a/src/Apache.IoTDB/Apache.IoTDB.csproj +++ b/src/Apache.IoTDB/Apache.IoTDB.csproj @@ -17,14 +17,13 @@ - + - + - + diff --git a/src/Apache.IoTDB/SessionPool.cs b/src/Apache.IoTDB/SessionPool.cs index 8d42282..1c12d85 100644 --- a/src/Apache.IoTDB/SessionPool.cs +++ b/src/Apache.IoTDB/SessionPool.cs @@ -21,6 +21,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Net; using System.Security.Cryptography.X509Certificates; using System.Threading; using System.Threading.Tasks; @@ -449,10 +450,18 @@ public async Task GetTimeZone() private async Task CreateAndOpen(string host, int port, bool enableRpcCompression, int timeout, bool useSsl, string cert, string sqlDialect, string database, CancellationToken cancellationToken = default) { + TTransport socket; - TTransport socket = useSsl ? - new TTlsSocketTransport(host, port, null, timeout, new X509Certificate2(File.ReadAllBytes(cert))) : - new TSocketTransport(host, port, null, timeout); + if (useSsl) + { + socket = IPAddress.TryParse(host, out var ipAddress) + ? new TTlsSocketTransport(ipAddress, port, null, cert) + : new TTlsSocketTransport(host, port, null, timeout, new X509Certificate2(cert)); + } + else + { + socket = new TSocketTransport(host, port, false, null, timeout); + } var transport = new TFramedTransport(socket);