简体   繁体   English

web.config中的连接字符串

[英]connectionstring in web.config

I have a connection string at web.config. 我在web.config中有一个连接字符串。 The data source is " .\\SQLEXPRESS " This works fine on local machine, but when I published the website using vs and an error occurred about sql connection. 数据源为“ .\\SQLEXPRESS ”,这在本地计算机上工作正常,但是当我使用vs发布网站时,发生了有关sql连接的错误。

I think there is some problem with ".". 我认为“。”存在一些问题。 Then I changed it to an IP Address, after that error occurred on both the local and remote machine. 然后,在本地和远程计算机上均发生该错误之后,我将其更改为IP地址。

I think the problem lies on the expression of data source. 我认为问题出在数据源的表达上。 Can anyone help me resolve this? 谁能帮我解决这个问题?

The error is: 错误是:

Server Error in '/' Application. “ /”应用程序中的服务器错误。 A network-related or instance-specific error occurred while establishing a connection to SQL Server. 建立与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. 验证实例名称正确,并且已将SQL Server配置为允许远程连接。 (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (提供者:SQL网络接口,错误:26-指定服务器/实例时出错)

The use of "." 指某东西的用途 ”。” is simply a shortcut for "localhost". 只是“本地主机”的快捷方式。 You must verify that there is a SQLEXPRESS named instance on the machine you are deploying to. 您必须验证要部署到的计算机上是否存在SQLEXPRESS命名实例。 If this is not the case, you must specify an appropriate data source. 如果不是这种情况,则必须指定适当的数据源。 You mentioned using an IP Address which will work, but that will again require an accessible endpoint at that location. 您提到使用有效的IP地址,但这再次需要该位置的可访问端点。

For more help, see the following: 有关更多帮助,请参见以下内容:

http://www.sqlmusings.com/2009/03/11/resolving-a-network-related-or-instance-specific-error-occurred-while-establishing-a-connection-to-sql-server/ http://www.sqlmusings.com/2009/03/11/resolving-a-network-related-or-instance-specific-error-occurred-while-building-a-connection-to-sql-server/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM