错误:26 - 错误定位服务器/实例指定。 (无法连接到我的本地数据库从我的主机服务器) [英] error: 26 - Error Locating Server/Instance Specified. (Can't connect to my local Db From my host server)

查看:2668
本文介绍了错误:26 - 错误定位服务器/实例指定。 (无法连接到我的本地数据库从我的主机服务器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经问过这个问题,但没有任何反应良好,
我的问题是,我在App_Data文件夹中有一个本地数据库(ASPNETDB.MDF),这里是在web.config中的连接字符串:

I already asked this question before, but without any good response, my problem is that I have a local database (aspnetdb.mdf) in my app_data folder, here is the connection string in the web.config :

<add name="ApplicationServices" 
     connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" 
     providerName="System.Data.SqlClient" />

所以我的网站在我的本地IIS服务器工作正常,但是当我把网站在我的主机服务器上,我得到这个错误信息:
而与SQL Server建立连接时出现与网络相关的或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确,以及SQL Server配置为允许远程连接。 (提供者:SQL网络接口,错误:26 - 错误定位服务器/实例指定)

so my site works fine in my local iis server, but when i put the site in my host server, I get this error message : 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).

在我的SQL Server 2008中其他服务器(远程连接被接受和我有相同的实例名称SQLEX preSS)。我真的什么都试过了,我可以,但没有任何好的结果。我真的会AP preciate你的帮助,THX。

In the other server I have sql server 2008 (the remote connection is accepted and i have the same instance name SQLEXPRESS). I really tried everything that I can but without any good results. I will really appreciate your help, thx.

推荐答案

此格式表明本地连接:

.\SQLEXPRESS

从另一台服务器,你需要指定服务器名称或IP地址,例如:

From another server, you'll need to specify a server name or IP address, e.g.:

192.168.1.205\SQLEXPRESS
YOURMACHINE\SQLEXPRESS

您还需要验证该实例的SQL Server防爆preSS。从<一个href=\"http://stackoverflow.com/questions/11820168/error-26-error-locating-server-instance-specified-cant-connect-to-my-local\">your其他几乎相同的问题的它看起来像一个默认实例。

You'll also need to validate that the instance is SQL Server Express. From your other nearly identical question it looks like a default instance.

您也应该停止使用这种无聊的用户实例/ attachDbFilename技术。附上您的数据库实例正确,则参考使用初始目录= aspnetdb的逻辑数据库名称; 您的连接的字符串中。该用户实例功能已被取消precated多种原因,这当然是其中之一。

You should also stop using this silly user instance / attachDbFilename technique. Attach your database to the instance properly, then reference the logical database name using Initial Catalog=aspnetdb; in your connection string. This user instance feature was deprecated for multiple reasons, and this is certainly one of them.

当然,可能还有其他的网络问题,将prevent这一点,例如如果服务器是在不同的领域,有防火墙设置的干扰等,但你的服务器是永远不会能够使用一个点作为服务器名称来访问你的机器。

Of course there may be other network issues that will prevent this, e.g. if the server is in a different domain, there are firewall settings interfering, etc. But your other server is never going to be able to access your machine using a dot for the server name.

修改提供婴儿的步骤,因为很明显我的建议没有被遵守。假设你实际上附着在新服务器上的数据库aspnetdb的,试试这个请:

EDIT providing baby steps because obviously my advice is not being followed. Assuming you have actually attached the aspnetdb database on the new server, try this please:

 connectionString="data source=192.168.85.124\SQLEXPRESS;
   Integrated Security=SSPI;
   Initial Catalog=aspnetdb;" 

如果您没有使用SQL防爆preSS命名实例毕竟尝试:

If you aren't using SQL Express named instance after all, try:

 connectionString="data source=192.168.85.124;
   Integrated Security=SSPI;
   Initial Catalog=aspnetdb;" 

有关SQL身份验证使用在Management Studio中使用相同的用户名/密码:

For SQL authentication use the same username/password you use in Management Studio:

 connectionString="data source=192.168.85.124;
   User ID=username; Password=password;
   Initial Catalog=aspnetdb;" 

这是故障排除101的东西。如果仍然不能得到这个工作,你可能要聘请顾问10分钟,为您解决问题,因为这是不可能找出你做了什么,以及为什么你不能得到它的工作。

This is troubleshooting 101 stuff. If you still can't get this to work, you may have to hire a consultant for 10 minutes to fix it for you since it's impossible to figure out what you've done and why you can't get it to work.

这篇关于错误:26 - 错误定位服务器/实例指定。 (无法连接到我的本地数据库从我的主机服务器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆