Openshift linux Pod 中的 .Net Core 应用连接到 SQL 服务器

.Net Core App in Openshift linux Pod connecting to SQL Server

我在 OpenShift 中部署了一个 .net Core Rest 服务,它连接到外部 SQL 服务器。我在命名空间的配置中添加了主机名。我还在边车中安装了 Kerberos

我仍然有连接错误

我的连接字符串如下

 "ConnectionStrings": {
    "SqlDbContext": "Server=ServerXYZ\InstanceXYZ,55001;Database=myAppDB;Integrated Security=True;
  }

我得到的错误是

“SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections

当我 运行 来自本地 windows PC 的 api 工作正常时,但我不确定是否需要为 OpenShift 调整连接字符串 Linux荚

解决方案是使用 SQL 服务器的完整域名 myserver.mydomain.com