我正在构建一个SMS应用程序并收到错误。我不明白错误,因为我是初学者。
连接字符串使用应用程序的App_Data目录中的数据库位置指定本地Sql Server Express实例。提供程序尝试自动创建应用程序服务数据库,因为提供程序确定数据库不存在。这里它显示为sql server express但我想使用sql server 2008 DB。
执行期间生成了未处理的异常 当前的网络请求。有关的来源和位置的信息 可以使用下面的异常堆栈跟踪来识别异常。
堆栈追踪:
[SqlException(0x80131904):与网络相关或特定于实例的 建立与SQL Server的连接时发生错误。该 服务器未找到或无法访问。验证该实例 名称是正确的,并且SQL Server配置为允许远程 连接。 (提供者:SQL网络接口,错误:26 - 错误 找到指定的服务器/实例)]
System.Data.SqlClient.SqlInternalConnection.OnError(SQLEXCEPTION exception,Boolean breakConnection)+5066458
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()+234
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler,Boolean ignoreSniOpenTimeout, Int64 timerExpire,布尔加密,布尔值trustServerCert,布尔值 integratedSecurity)+341
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo,String newPassword,Boolean ignoreSniOpenTimeout, TimeoutTimer超时,SqlConnection owningObject)+129
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo,String newPassword,Boolean redirectedUserInstance, SqlConnection owningObject,SqlConnectionString connectionOptions, TimeoutTimer超时)+270
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(的SqlConnection owningObject,TimeoutTimer超时,SqlConnectionString connectionOptions,String newPassword,Boolean redirectedUserInstance) +195 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity) identity,SqlConnectionString connectionOptions,Object providerInfo, String newPassword,SqlConnection owningObject,Boolean redirectedUserInstance)+232
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options,Object poolGroupProviderInfo,DbConnectionPool池, DbConnection owningConnection)+5080107
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(的DbConnection owningConnection,DbConnectionPoolGroup poolGroup)+31
System.Data.ProviderBase.DbConnectionFactory.GetConnection(的DbConnection 拥有连接)+76
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(的DbConnection outerConnection,DbConnectionFactory connectionFactory)+126
System.Data.SqlClient.SqlConnection.Open()+ 125 System.Web.Management.SqlServices.GetSqlConnection(String server, String user,String password,Boolean trusted,String connectionString)+82[HttpException(0x80004005):无法连接到SQL Server 数据库]
System.Web.Management.SqlServices.GetSqlConnection(String server, String user,String password,Boolean trusted,String connectionString)+137
System.Web.Management.SqlServices.SetupApplicationServices(字符串 server,String user,String password,Boolean trusted,String connectionString,String database,String dbFileName,SqlFeatures 功能,布尔安装)+94
System.Web.Management.SqlServices.Install(String database,String dbFileName,String connectionString)+27
System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(字符串 fullFileName,String dataDir,String connectionString)+395
答案 0 :(得分:1)
您是否已将连接字符串添加到web.config文件中?如果你有,它看起来像什么? 抱歉,由于没有足够的积分,我无法添加评论。