发布构建(优化代码)不会部署到 AWS

Release Build (Optimized Code) won't deploy to AWS

目前正致力于从 Azure 迁移到 AWS。我已经设置好所有内容和 运行(带有 Classic Load Balancer 的 Elastic Beanstalk,通过证书管理器的 SSL,以及通过 Route 53 的子域),但是我目前只能使用 AWS Toolkit for Visual Studio 进行部署,当我 select 作为项目构建配置进行调试。如果我选择 Release(我已将其重命名为 Production),它会成功构建,但无法部署。

我收到以下错误:

....packaging -  project build completed successfully.
....packaging -  CreateProviderList: build error: 'E:\Program Files (x86)\Microsoft Visual Studio17\Community\MSBuild\Microsoft\VisualStudio\v15.0\Web\Deploy\Microsoft.Web.Publishing.MSDeploy.Common.targets' at (55,5): Web deployment task failed. (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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified))
....packaging -  project build completed with errors.
..build of project archive failed, abandoning deployment

不确定到底出了什么问题,它提到 SQL 错误,我唯一拥有的是 web.config 中 RDS 的实体和其他连接字符串。如果提供我的网络配置对我有帮助,我可以根据要求在此处添加编辑版本。

MS SQL RDS 实例不是 Elastic Beanstalk 的一部分。它位于 VPC 中,并且已配置适当的安全性。正如我所说,它在构建和部署 Debug 构建时连接并工作得很好,但在创建 Release 构建时它不会工作。

想通了。我以某种方式在 Package/Publish SQL 下添加了发布版本的条目。我删除了它并且它部署并且没有问题地工作。 (要查找,右击项目->属性->Package/PublishSQL)。