为什么连接字符串在生产中不起作用 asp.net?
Why connection string is not working in production asp.net?
我正在尝试将我的应用程序与服务器上的数据库连接以进行生产,但它抛出了如下错误:
ERROR: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)
在 web.config
中,我有用于开发的连接字符串,它工作得很好,但是当我为生产更改它时,它不起作用。这是我所做的:
<connectionStrings>
<add name="Vulosjet"
connectionString="Data Source=IP;Initial Catalog=Vulosjet;Integrated Security=false;User ID=********;Password=********" />
<add name="Vulosjet_app.Properties.Settings.VulosjetConnectionString"
connectionString="Data Source=IP;Initial Catalog=Vulosjet;Integrated Security=false;User ID=********;Password=********"
providerName="System.Data.SqlClient" />
</connectionStrings>
有什么帮助吗?
您的 Vulosjet 连接字符串中缺少 providerName。
仅使用一个连接名称,您可以通过部署方法更改内容。将其视为具有不同值的变量,具体取决于它的部署位置。阅读有关 "web.config transformations" 的内容,了解您是如何实现这一目标的。
其次,确保您可以从生产环境访问数据库服务器。
整理好这些东西,你就可以开始了。
可能的原因有很多:
- Sql 服务器实例名称不同(不是默认的 MSSQLSERVER)- 您需要在服务器名称中指定它,例如
10.10.42.53/SQLProd
什么的
- Prod 服务器上 SQL 配置了哪些协议?如果您想以这种方式连接,您可能需要启用 TCP/IP...
- 存在防火墙问题,可能是 Prod 中 SQL 服务器上的软件,也可能是两者之间网络中的某个地方。
- 存在一个基本的网络问题 - PROD Web 服务器与 PROD SQL 服务器之间没有直接的路由。
这(目前)还不是身份验证问题。它只是看不到 server/instance
我正在尝试将我的应用程序与服务器上的数据库连接以进行生产,但它抛出了如下错误:
ERROR: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)
在 web.config
中,我有用于开发的连接字符串,它工作得很好,但是当我为生产更改它时,它不起作用。这是我所做的:
<connectionStrings>
<add name="Vulosjet"
connectionString="Data Source=IP;Initial Catalog=Vulosjet;Integrated Security=false;User ID=********;Password=********" />
<add name="Vulosjet_app.Properties.Settings.VulosjetConnectionString"
connectionString="Data Source=IP;Initial Catalog=Vulosjet;Integrated Security=false;User ID=********;Password=********"
providerName="System.Data.SqlClient" />
</connectionStrings>
有什么帮助吗?
您的 Vulosjet 连接字符串中缺少 providerName。
仅使用一个连接名称,您可以通过部署方法更改内容。将其视为具有不同值的变量,具体取决于它的部署位置。阅读有关 "web.config transformations" 的内容,了解您是如何实现这一目标的。
其次,确保您可以从生产环境访问数据库服务器。
整理好这些东西,你就可以开始了。
可能的原因有很多:
- Sql 服务器实例名称不同(不是默认的 MSSQLSERVER)- 您需要在服务器名称中指定它,例如
10.10.42.53/SQLProd
什么的 - Prod 服务器上 SQL 配置了哪些协议?如果您想以这种方式连接,您可能需要启用 TCP/IP...
- 存在防火墙问题,可能是 Prod 中 SQL 服务器上的软件,也可能是两者之间网络中的某个地方。
- 存在一个基本的网络问题 - PROD Web 服务器与 PROD SQL 服务器之间没有直接的路由。
这(目前)还不是身份验证问题。它只是看不到 server/instance