诡异的数据库连接问题
小弟参加一个人网页设计比赛,采用SQL Server2005+asp.net2.0。在自己的环境上运行没有问题,临时演示的时候问朋友借了个笔记本,重新安装系统和环境,然后通过分离-附加的方式把数据库移植到笔记本上,然后将.net程序也弄到笔记本上。
在执行数据操作的地方页面就显示不了,报错如下:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:
System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
请问这是哪里的问题呢?
PS:企业管理器的设置和本机上完全一样。数据库连接字符串也没问题。
------解决方案--------------------看看sql配置中
协议部分的 tcp/ip和共享内存 是否都启用了
如果实在不好用,就改用windows验证连接吧
------解决方案--------------------是不是没有启动混合登录方式?或者有防火墙
------解决方案--------------------你可以在dos下使用telnet、osql等先测试一下数据库是否可以访问。
自从当初 SQL Server 嵌入版故意在asp.net下产生异常,不让用,我就放弃Sql Server了,我当时第一个选择是使用 SQLite(http://www.sqlite.com.cn/MySqlite/3/375.Html)。
道理很简单,既然桌面应用和移动应用允许使用Sql ,为什么要限制asp.net使用呢。纯粹是搞技术的人才会想出来的歪招,搞技术的人往往不顾信誉,只好放弃。