用于 ADO.NET 4.5 的非 1433 端口Ports beyond 1433 for ADO.NET 4.5

适用于:是Azure SQL 数据库 APPLIES TO: yesAzure SQL Database

本主题介绍使用 ADO.NET 4.5 或更高版本的客户端的 Azure SQL 数据库连接行为。This topic describes the Azure SQL Database connection behavior for clients that use ADO.NET 4.5 or a later version.

重要

有关连接体系结构的信息,请参阅 Azure SQL 数据库连接体系结构For information about connectivity architecture, see Azure SQL Database connectivity architecture.

外部与内部Outside vs inside

对于 Azure SQL 数据库的连接,首先必须询问客户端程序是在 Azure 云边界外部还是内部运行。For connections to Azure SQL Database, we must first ask whether your client program runs outside or inside the Azure cloud boundary. 以下小节讨论了两种常见方案。The subsections discuss two common scenarios.

外部: 客户端在台式机上运行Outside: Client runs on your desktop computer

端口 1433 是托管 SQL 数据库客户端应用程序的台式计算机上唯一必须打开的端口。Port 1433 is the only port that must be open on your desktop computer that hosts your SQL Database client application.

内部: 客户端在 Azure 上运行Inside: Client runs on Azure

如果客户端在 Azure 云边界内部运行,则它使用我们所谓的直接路由来与 SQL 数据库交互。When your client runs inside the Azure cloud boundary, it uses what we can call a direct route to interact with SQL Database. 建立连接后,客户端与数据库之间的进一步交互不涉及到任何 Azure SQL 数据库网关。After a connection is established, further interactions between the client and database involve no Azure SQL Database Gateway.

顺序如下:The sequence is as follows:

  1. ADO.NET 4.5(或更高版本)发起与 Azure 云的简短交互,并接收动态识别的端口号。ADO.NET 4.5 (or later) initiates a brief interaction with the Azure cloud, and receives a dynamically identified port number.

    • 动态识别的端口号范围为 11000-11999。The dynamically identified port number is in the range of 11000-11999.
  2. 然后,ADO.NET 不通过任何中间件直接连接到 SQL 数据库。ADO.NET then connects to SQL Database directly, with no middleware in between.

  3. 查询直接发送到数据库,结果直接返回到客户端。Queries are sent directly to the database, and results are returned directly to the client.

确保 Azure 客户端计算机上 11000-11999 的端口范围已保留,供 ADO.NET 4.5 客户端与 SQL 数据库的交互使用。Ensure that the port ranges of 11000-11999 on your Azure client machine are left available for ADO.NET 4.5 client interactions with SQL Database.

  • 具体而言,范围中的端口必须没有其他任何出站阻塞器。In particular, ports in the range must be free of any other outbound blockers.

  • 在 Azure VM 上, 高级安全 Windows 防火墙 控制端口设置。On your Azure VM, the Windows Firewall with Advanced Security controls the port settings.

    • 可以使用防火墙的用户界面为指定 TCP 协议以及语法类似于 11000-11999 的端口范围添加规则。You can use the firewall's user interface to add a rule for which you specify the TCP protocol along with a port range with the syntax like 11000-11999.

版本澄清Version clarifications

本部分澄清引用产品版本的 Moniker。This section clarifies the monikers that refer to product versions. 此外还列出了产品之间的版本配对。It also lists some pairings of versions between products.

ADO.NETADO.NET

  • ADO.NET 4.0 支持 TDS 7.3 协议,但不支持 7.4。ADO.NET 4.0 supports the TDS 7.3 protocol, but not 7.4.
  • ADO.NET 4.5 和更高版本支持 TDS 7.4 协议。ADO.NET 4.5 and later supports the TDS 7.4 protocol.

ODBCODBC

  • Microsoft SQL Server ODBC 11 或更高版本Microsoft SQL Server ODBC 11 or above

JDBCJDBC

  • Microsoft SQL Server JDBC 4.2 或更高版本(JDBC 4.0 实际上支持 TDS 7.4,但未实现“重定向”)Microsoft SQL Server JDBC 4.2 or above (JDBC 4.0 actually supports TDS 7.4 but does not implement "redirection")