AWS RDS SQL 数据库在本地主机上工作——从服务器抛出错误
AWS RDS SQL database works on localhost -- throws error from server
我正在创建一个 API 来调用托管在 AWS RDS 上的 SQL Express 数据库。当我在我的本地主机上访问端点时,一切正常并返回数据。我还可以使用桌面上的相同连接字符串通过 SSMS 进行连接
但是,在我将 API 部署到 Elastic Beanstalk 然后调用同一端点后,我收到此错误:
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. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
实例class设置为db.t3.small.
通过阅读,我似乎需要以某种方式在 elastic beanstalk 站点上打开端口 1430。但是我不知道该怎么做。
看起来像是入站规则问题。您必须为安全组设置入站规则才能连接到数据库。您可以为您的开发环境设置一个入站规则,为 Elastic Beanstalk(将托管应用程序)设置另一个入站规则。有关设置安全组入站规则的信息,请参阅 Controlling Access with Security Groups。
我正在创建一个 API 来调用托管在 AWS RDS 上的 SQL Express 数据库。当我在我的本地主机上访问端点时,一切正常并返回数据。我还可以使用桌面上的相同连接字符串通过 SSMS 进行连接
但是,在我将 API 部署到 Elastic Beanstalk 然后调用同一端点后,我收到此错误:
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. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
实例class设置为db.t3.small.
通过阅读,我似乎需要以某种方式在 elastic beanstalk 站点上打开端口 1430。但是我不知道该怎么做。
看起来像是入站规则问题。您必须为安全组设置入站规则才能连接到数据库。您可以为您的开发环境设置一个入站规则,为 Elastic Beanstalk(将托管应用程序)设置另一个入站规则。有关设置安全组入站规则的信息,请参阅 Controlling Access with Security Groups。