生产服务器帮助plz上的连接字符串错误26 [英] connection string error 26 on production server help plz

查看:65
本文介绍了生产服务器帮助plz上的连接字符串错误26的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我的本地计算机上有一个asp.net网站,使用连接字符串
可以正常运行

 <   connectionStrings  > ; 
  <  添加    ="   ConnectionString"  connectionString   数据源= .\ SQLEXPRESS; AttachDbFilename = | DataDirectory | \ Database1.mdf; Integrated Security = True; User Instance = True" 
        providerName   ="    / > 
 <  /connectionStrings  >   



在生产服务器(共享主机)上,我必须通过运行查询在服务器上创建我的数据库(使用用户名和密码),该数据库已成功在所有表上创建,例如在开发机上,并且出现错误(在我的login.aspx上)页)当尝试使用登录页登录时,我使用了此连接字符串

 <   connectionStrings  > ; 
  <  添加    ="   ConnectionString"  connectionString   数据源= .\ SQLEXPRESS;集成安全性= SSPI;数据库=数据库1;连接超时= 30;用户ID =数据库用户ID;密码=数据库用户密码" 
        providerName   ="    / > 
 <  /connectionStrings  >   



但是我遇到了同样的错误(在login.aspx页面上),当我尝试使用其login.aspx页面登录我的网站时遇到了同样的错误,错误在下面给出

建立与SQL Server的连接时发生了与网络相关或特定于实例的错误.找不到服务器或无法访问该服务器.请验证实例名称正确且SQL Server已配置为允许远程连接.(提供者: SQL网络接口,错误:26-错误指定服务器/实例的位置)"

请任何人告诉我应该使用什么连接字符串,以便我可以运行我的网站而不会出现此错误.

谢谢

解决方案

0)您的Web服务器与数据库服务器位于同一盒子上吗?在生产环境中?您的系统管理员应该被枪杀.

1)您正在使用SQLExpress运行生产数据库吗?您的经理应该被枪杀.

2) Sql服务器连接字符串示例 [


可能有很多原因,请阅读此内容

SQL SERVER连接问题 [<connectionStrings> <add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" /> </connectionStrings>



on production server(shared hosting) i had to create my database( with a user name and a password) on server by running query it was created successfully with all the tables like on development machine, and i got error(on my login.aspx page) when tried to log in using login page then i used this connection string

<connectionStrings>
  <add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;Integrated Security=SSPI;database=Database1;Connection Timeout=30;User id=databaseuserid;Password=databaseuserpassword"

   providerName="System.Data.SqlClient" />
 </connectionStrings>



but i got same error(on login.aspx page) which i got earlier when i tried to log in to my website using its login.aspx page, error is given below

"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)"

Plz can anyone tell me what CONNECTION STRING i should use so that i can run my website without this error.

Thanks

解决方案

0) Your web server is on the same box as your database server? In a production environment? Your sysadmin should be shot.

1) You''re running a production database with SQLExpress? Your manager should be shot.

2)
Sql server connection string samples [^]


I don''t think a hosting server will use SQL EXPRESS, you can try below connectionstrings

"Server=localhost;Database=yourDB;User ID=yourID;Password=yourPass;"


There may be many reasons, read this

SQL SERVER connection problem[^]


这篇关于生产服务器帮助plz上的连接字符串错误26的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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