SQL Connection Err

Last post 07-07-2009 5:16 AM by Thomas Sun – MSFT. 3 replies.

Sort Posts:

  • SQL Connection Err

    07-03-2009, 11:31 AM

    Hello everybody,

    I've been giving the publishing link from the web server admin and I published my project there. however, when I want to check any page using my database, it gives me this error

    the database resides in the App_Data folder of my project and my connection string is :

    <

    add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MyDB.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>

    Please help!!!!

    Server Error in '/' Application.

     


     

    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)

    Description:

    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.


    Stack Trace:

    [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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]

    System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4844759

    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194

    System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +4858065

    System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +90

    System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +376

    System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +221

    System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189

    System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +4859187

    System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +31

    System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +433

    System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66

    System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +499

    System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +65

    System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117

    System.Data.SqlClient.SqlConnection.Open() +122

    System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +31

    System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +112

    System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +287

    System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +92

    System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1297

    System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +19

    DevExpress.Web.ASPxClasses.Internal.DataHelper.PerformSelect() +149

    DevExpress.Web.ASPxGridView.GridViewDataHelper.PerformSelect() +119

    DevExpress.Web.ASPxClasses.Internal.DataContainer.PerformSelect() +124

    DevExpress.Web.ASPxClasses.ASPxDataWebControlBase.DataBindCore() +15

    DevExpress.Web.ASPxClasses.ASPxDataWebControlBase.DataBind() +104

    DevExpress.Web.ASPxGridView.ASPxGridView.DataBind() +190

    DevExpress.Web.ASPxClasses.Internal.DataHelperBase.EnsureDataBound(Boolean ensureChildControls) +89

    DevExpress.Web.ASPxClasses.Internal.DataContainer.EnsureDataBound() +132

    DevExpress.Web.ASPxClasses.ASPxDataWebControlBase.OnPreRender(EventArgs e) +22

    System.Web.UI.Control.PreRenderRecursiveInternal() +80

    System.Web.UI.Control.PreRenderRecursiveInternal() +171

    System.Web.UI.Control.PreRenderRecursiveInternal() +171

    System.Web.UI.Control.PreRenderRecursiveInternal() +171

    System.Web.UI.Control.PreRenderRecursiveInternal() +171

    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

    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: 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)

    Source Error:

  • Re: SQL Connection Err

    07-04-2009, 2:20 AM
    Answer
    • Contributor
      5,490 point Contributor
    • integrasol
    • Member since 06-05-2009, 3:18 PM
    • Posts 1,041

    Has SQL Server Express Edition been installed on the server, and if so, is it using the default instance name, SQLEXPRESS?

    Thanks and HTH

    Carsten

    Please mark this post as Answer if it is of help to you. :-)
  • Re: SQL Connection Err

    07-04-2009, 3:33 AM
    Answer
  • Re: SQL Connection Err

    07-07-2009, 5:16 AM
    Answer

    Hi,

    If host server support SQL Server Express Edition, we need to make sure the connection string is correct, such as server name and make sure the instance name is correct and there is actually such an instance on target machine. For more information, see http://blogs.msdn.com/sql_protocols/archive/2007/05/13/sql-network-interfaces-error-26-error-locating-server-instance-specified.aspx

    If there is not SQL Server Express Edition on host server. For example, the SQL Server Full Edition is available on server, you can attach the database file to SQL server or create new database on it, and then modify connection string to point new database in web.config.

    For more information about connection string, see http://www.connectionstrings.com and (Deploying a SQL Database to a Remote Hosting Environment) http://weblogs.asp.net/scottgu/archive/2006/12/22/recipe-deploying-a-sql-database-to-a-remote-hosting-environment-part-1.aspx


    I look forward to receiving your test results.

    Thomas Sun
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
Page 1 of 1 (4 items)