Linux Docker 中的 SQL Server 实例字符串连接 [英] SQL Server instance string connection in Linux Docker

查看:23
本文介绍了Linux Docker 中的 SQL Server 实例字符串连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将应用程序发布到在连接字符串中引用 Sql Server 实例的 docker 映像 microsoft/dotnet:1.0.1-core:

I'm publishing an application to docker image microsoft/dotnet:1.0.1-core that reference Sql Server instance in connection string:

"Data Source=hostinstance;Initial Catalog=database;User ID=user;Password=pass;"

在 Windows 环境下也可以,但是使用 docker 时,应用程序无法连接到数据库.将 Data Source 更改为使用 port 而不是 instance 就可以了.

In Windows environment it work's as well, but using docker, the application cannot connect to the database. Changing the Data Source to use port instead of instance it works.

"Data Source=host,port;Initial Catalog=database;User ID=user;Password=pass;"

如何使用实例而不是端口从 docker 连接到 Sql Server?

How can I connect, from docker, to Sql Server using instance instead port?

推荐答案

根据来自 Microsoft 的 Saurabh Singh:

实例名称支持在 .Net Core 的 v 1.1 中可用.在 .Net Core v1.0 中,Windows 以外的操作系统不支持实例名称.

The Instance name support is available in v 1.1 of .Net Core. In v1.0 of .Net Core, Instance names are not supported on OS other than Windows.

所以我认为您无法使用实例名称从运行在 Linux 上的 .Net Core 1.0 连接到 SQL Server.

So I don't think you can connect from .Net Core 1.0 running on Linux to an SQL Server using instance name.

您的选择似乎是:

  • 不要使用实例名称
  • 等待 .Net Core 1.1(计划于秋季2016")
  • 使用 .Net Core 1.1 的预发布版本

这篇关于Linux Docker 中的 SQL Server 实例字符串连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆