我无法弄清楚我在这里做错了什么。我已经尝试了一切:我的连接字符串,关闭防火墙,允许远程连接,但我仍然一直收到此错误:
建立与SQL Server的连接时发生与网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。 (提供程序:SQL网络接口,错误:26 - 查找指定的服务器/实例时出错)
[SqlException(0x80131904):建立与SQL Server的连接时发生与网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。 (提供程序:SQL网络接口,错误:26 - 找到指定的服务器/实例时出错)] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception,Boolean breakConnection,Action
1 wrapCloseInAction) +6568558 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +717 System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover) +6595000 System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +219 System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +6597311 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +6597891 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData) +942 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +1162 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +72 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +6601145 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +103 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +2102 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource
1 retry,DbConnectionOptions userOptions,DbConnectionInternal& connection)+116 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection,TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +1079 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource
1 retry,DbConnectionOptions userOptions)+6605639 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource1 retry) +233 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource
1次重试)+278 System.Data.SqlClient.SqlConnection.Open()+239 System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.Dispatch(TTarget target, Action
2操作,TInterceptionContext interceptionContext,Action3 executing, Action
3执行)+207 System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection,DbInterceptionContext interceptionContext)+438 System.Data.Entity.SqlServer。<> c__DisplayClass33.b__32()+ 582 System.Data.Entity.SqlServer。<> c__DisplayClass1.b__0()+15 System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Func1 operation) +263 System.Data.Entity.SqlServer.SqlProviderServices.UsingMasterConnection(DbConnection sqlConnection, Action
1 act)+749 System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabase(DbConnection连接,Nullable1 commandTimeout, StoreItemCollection storeItemCollection) +314 System.Data.Entity.Migrations.Utilities.DatabaseCreator.Create(DbConnection connection) +329 System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(Action mustSucceedToKeepDatabase) +230 System.Data.Entity.Internal.DatabaseCreator.CreateDatabase(InternalContext internalContext, Func
3 createMigrator,ObjectContext objectContext)+130 System.Data.Entity.Database.Create(DatabaseExistenceState existState)+267 System.Data.Entity.CreateDatabaseIfNotExists1.InitializeDatabase(TContext context) +217 System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +66 System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +596 System.Data.Entity.Internal.RetryAction
1.PerformAction(TInput input)+208 System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action1 action) +263 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +39 System.Data.Entity.Internal.Linq.InternalSet
1.Initialize()+72 System.Data.Entity.Internal.Linq.InternalSet1.get_InternalContext() +21 System.Data.Entity.Infrastructure.DbQuery
1.System.Linq.IQueryable.get_Provider()+64 System.Data.Entity.QueryableExtensions.FirstOrDefaultAsync(IQueryable1 source, Expression
1个谓词,CancellationToken cancellationToken)+218 System.Data.Entity.QueryableExtensions.FirstOrDefaultAsync(IQueryable1 source, Expression
1个谓词)+113 Microsoft.AspNet.Identity.d__13.MoveNext()+229 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+144 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+84 Microsoft.AspNet.Identity.d__d.MoveNext()+ 455 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+144 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+84 System.Runtime.CompilerServices.TaskAwaiter1.GetResult() +49 Microsoft.AspNet.Identity.AsyncHelper.RunSync(Func
1 func)+235 DaveyMaherFitness.Logic.RoleActions.AddUserAndRole()+ 151[HttpException(0x80004005):建立与SQL Server的连接时发生与网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。 (提供程序:SQL网络接口,错误:26 - 找到指定的服务器/实例时出错)] System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context,HttpApplication app)+12601933 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext,HttpContext context,MethodInfo [] handlers)+175 System.Web.HttpApplication.InitSpecial(HttpApplicationState状态,MethodInfo []处理程序,IntPtr appContext,HttpContext上下文)+304 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext,HttpContext context)+404 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)+475
[HttpException(0x80004005):建立与SQL Server的连接时发生与网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。 (提供程序:SQL网络接口,错误:26 - 找到指定的服务器/实例时出错)] System.Web.HttpRuntime.FirstRequestInit(HttpContext context)+12618980 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)+159 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext context)+12458597
任何建议都会受到赞赏,我觉得我只是忽略了一些东西!
答案 0 :(得分:0)
这简单地说它无法建立与服务器的连接,可能有十几个原因。
可能是SQL-SERVER配置的Windows模式身份验证,您正在尝试sql-server身份验证。 或者没有为远程连接配置sql-server 或者您使用的是错误的凭证。 或者最坏的连接字符串不正确。
无论如何,我强烈建议在VS中使用Server面板,并在该面板上进行测试连接,这样你就可以更容易地找出错误。