在客户端机器上找不到数据库服务器
在过去的一周中,我一直在尝试创建我的Windows应用程序的设置。在客户端机器上找不到数据库服务器
我创建了一个Windows应用程序,我想在客户机上安装它。为此,我在创建安装项目的前提下添加了Microsoft SQL Server 2008 Express。现在
为了安装创造客户机上的数据库和表我的数据库架构,我已经在项目中创建一个安装程序类,并添加来自installer class steps
refrenced一个自定义操作,这是我的连接字符串
Data Source=localhost;Initial Catalog=master;Integrated Security=True;User Instance=True
但我只收到此错误:
System.Data.SqlClient.SqlException (0x80131904): 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)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity)
at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at WindowsFormsApplication5.Installer1.ExecuteSql(String serverName, String dbName, String Sql)
更改数据源.\SQLEXPRESS
CA使用此错误:
System.InvalidOperationException: Instance failure.
at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity)
at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject)
注:执行脚本安装我的数据库的模式..
我只是想安装我的Windows数据库应用程序的客户端机器,我得到这个错误。由于我已经在时间上缺乏,任何其他建议,也欢迎...
问候,马赫什
Data Source=.\SQLEXPRESS;Initial Catalog=master;Integrated Security=True;User Instance=True
一个SQL Express实例通常被称为\的SQLExpress,即改变你的连接字符串“数据来源=。\ SQLEXPRESS; ...' – StuartLC
@nonnb看到我修改的问题,因为它也给我错误 – mahesh
那么,什么是问题?您无法连接到您的数据库,我假设安装了Microsoft SQL Server 2008 Express,因为它是您的先决条件。 SQL服务正在运行吗? – Jodrell