IIS 8.5部署期间定位服务器26时SQL错误

本文关键字:服务器 26时 SQL 错误 定位 部署 IIS | 更新日期: 2023-09-27 18:25:46

当试图在本地计算机上使用IIS将项目部署到网站时,我收到了SQL网络接口错误26(详细错误如下)。

按照指南中的说明,尝试从zip文件部署sensenet。

我一直在使用MSDN、Stack和Code Project上的在线建议解决问题,但到目前为止还没有任何效果。

我已经禁用了Windows防火墙和我的第三方防火墙。我使用的端口是8081(8080由我的IIS上的一个工作网站使用),我还检查了SQL服务是否正在运行。TCP/IP也按照此方法启用。

我正试图用SenseNet提供的安装zip中的脚本创建一个新的DB。

我使用的是IIS 8.5、web部署5和SQL management studio 2012。

对于可能导致此错误的原因,有人有其他建议吗?

感谢

摘要

无法创建数据库"SNCR"。建立与SQL Server的连接时,发生了与网络相关或特定于实例的错误。找不到或无法访问服务器。请验证实例名称是否正确,以及SQL Server是否已配置为允许远程连接。(提供程序:SQL网络接口,错误:26-定位指定的服务器/实例时出错)


警告:无法创建数据库"SNCR"
正在对对象dbFullSql重试操作"添加"(server=".C:''Program Files''Microsoft SQL server''MSSQL11.MSSQLSERVER''MSSQL";database=SNCR;uid=sa)。尝试第1次,共5次。

详细

Microsoft.Web.Deployment.DeploymentClientServerException: The database 'SNCR' could not be created. ---> System.Data.SqlClient.SqlException: 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)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover)
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.Open()
   at Microsoft.Web.Deployment.SqlServerDatabaseProvider.AddHelper(DeploymentObject source)
   --- End of inner exception stack trace ---
   at Microsoft.Web.Deployment.DeploymentObject.Add(DeploymentObject source, DeploymentSyncContext syncContext)
   at Microsoft.Web.Deployment.DeploymentSyncContext.HandleAdd(DeploymentObject destObject, DeploymentObject sourceObject)
   at Microsoft.Web.Deployment.DeploymentSyncContext.HandleUpdate(DeploymentObject destObject, DeploymentObject sourceObject)
   at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildrenOrder(DeploymentObject dest, DeploymentObject source)
   at Microsoft.Web.Deployment.DeploymentSyncContext.ProcessSync(DeploymentObject destinationObject, DeploymentObject sourceObject)
   at Microsoft.Web.Deployment.DeploymentObject.SyncToInternal(DeploymentObject destObject, DeploymentSyncOptions syncOptions, PayloadTable payloadTable, ContentRootTable contentRootTable)
   at Microsoft.Web.Deployment.DeploymentObject.SyncTo(DeploymentProviderOptions providerOptions, DeploymentBaseOptions baseOptions, DeploymentSyncOptions syncOptions)
   at Microsoft.Web.Deployment.UI.InstallProgressWizardPage.OnWorkerDoWork(Object sender, DoWorkEventArgs e)
   at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

IIS 8.5部署期间定位服务器26时SQL错误

检查web.config文件:查找SQL连接字符串,查看在安装过程中添加了什么用户名和密码(它不应该是"sa"用户,而是像"sensenet6"这样的自定义帐户)。该用户应该有权访问数据库,该数据库也被添加到连接字符串中。以下是一个论坛主题,可能会有所帮助:http://forum.sensenet.com/viewtopic.php?f=3&t=7279&p=10803&hilit=404&sid=c79596c733ccd9b721