locked
Error when running TimeTracker RRS feed

  • Question

  • User912512718 posted

    I am getting this error when I attempt to run TimeTracker:

     

     

     

    Server Error in '/TimeTracker' 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 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:

    Line 11:         if (Roles.Enabled)
    Line 12:         {
    Line 13:             if (!Roles.RoleExists("ProjectAdministrator"))
    Line 14:             {
    Line 15:                 Roles.CreateRole("ProjectAdministrator");

    Source File: c:\Asim\Projects\SampleApps\TimeTracker\Global.asax    Line: 13

    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) +4849719
       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) +4863021
       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) +4864151
       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.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +87
       System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +221
       System.Web.Security.SqlRoleProvider.RoleExists(String roleName) +478
       System.Web.Security.Roles.RoleExists(String roleName) +73
       ASP.global_asax.Application_Start(Object sender, EventArgs e) in c:\Asim\Projects\SampleApps\TimeTracker\Global.asax:13
    


    Version Information: Microsoft .NET Framework Version:2.0.50727.4200; ASP.NET Version:2.0.50727.4016

    <!-- [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) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, 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 System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) at System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) at System.Web.Security.SqlRoleProvider.RoleExists(String roleName) at System.Web.Security.Roles.RoleExists(String roleName) at ASP.global_asax.Application_Start(Object sender, EventArgs e) in c:\Asim\Projects\SampleApps\TimeTracker\Global.asax:line 13 -->
    Thursday, January 7, 2010 12:21 AM

All replies

  • User-1659704165 posted

    Hi,

    Chk your connection string.

    Thursday, January 7, 2010 1:09 AM
  • User912512718 posted

    I am running this on SQL 2005, on localhost.

    What should my web.config connection string be? 

    Thursday, January 7, 2010 1:24 AM
  • User-1659704165 posted

    I mean where database connection is defined..

    http://www.connectionstrings.com/sql-server-2005

    like above

    u may have check in web.config file..

    http://www.dotnetjohn.com/articles.aspx?articleid=3

    Thursday, January 7, 2010 1:26 AM
  • User555306248 posted

    You have to register your DB with ASP.NET Membership classes by executing the command line utility in VS prompt

    aspnet_regsql, it will open one window, where you  have to configure DB.

    Add the following lines under <system.web>

           <membership>
    
          <providers>
             <remove name="AspNetSqlMembershipProvider" />
             <add name="AspNetSqlMembershipProvider"
               type="System.Web.Security.SqlMembershipProvider,
               System.Web, Version=2.0.0.0, Culture=neutral,                                
               PublicKeyToken=b03f5f7f11d50a3a"
               connectionStringName="vsItemsConnectionString"
               enablePasswordRetrieval="false"
               enablePasswordReset="true"
               requiresQuestionAndAnswer="true"
               applicationName="/"
               requiresUniqueEmail="false"
               passwordFormat="Hashed"
               maxInvalidPasswordAttempts="5"
               minRequiredPasswordLength="7"
               minRequiredNonalphanumericCharacters="1"
               passwordAttemptWindow="10"
               passwordStrengthRegularExpression="" />
           </providers>
    
       </membership>
    
       <profile>
           <providers>
              <remove name="AspNetSqlProfileProvider" />
              <add name="AspNetSqlProfileProvider"
                 connectionStringName="vsItemsConnectionString"                           
                 applicationName="/"
                 type="System.Web.Profile.SqlProfileProvider,
                 System.Web, Version=2.0.0.0, Culture=neutral,                   
                 PublicKeyToken=b03f5f7f11d50a3a" />
            </providers>   
       </profile>
    
       <roleManager>
            <providers>
              <remove name="AspNetSqlRoleProvider" />
              <add name="AspNetSqlRoleProvider"
                 connectionStringName="vsItemsConnectionString"
                 applicationName="/"
                 type="System.Web.Security.SqlRoleProvider,
                 System.Web, Version=2.0.0.0, Culture=neutral,                               
                 PublicKeyToken=b03f5f7f11d50a3a" />
            </providers>
       </roleManager>
    Refere this thread
    http://forums.asp.net/t/1008091.aspx
    http://forums.asp.net/t/1337137.aspx
    
    Thursday, January 7, 2010 10:11 PM
  • User912512718 posted

    Chetan, I already registered the DB.

    Still getting that error.

    Thursday, January 7, 2010 10:46 PM
  • User555306248 posted

    SQL Server Express - SQL Server Standard - SQL Server Developer.

    Problem Solved: Difficulty - Medium.

    Assumption: More than one SQL Server Instance and version are runnintg.  Your most likely trying to connect to a SQL Server Express  MDF file The solution below is viable if your running more robust versions of SQL Server and working with an express database.

    Resolution

    1) Check your running processes & instances (2000, 20005 Standard, 2005 Express).  If you see only one instance and version, the instructions below are worthless.

    2) Shut down SQL Server Express.

    3) Create a database, don't fret over the name.  This can be handled in your config files and from management studio.

    4) Restore your new database fromthe MDF\LDF files.

    5)  Check your machine config (1 & 2).  Change the connection string "LocalSQLServer".  You can  build the connnection string from Studio 2005\2008. 

    6) Change you machine config &\or  web.config to use the new connection string. Choose the correct provider.

    7) Stop SQL Server Express - put it into manual mode & keep it that way.

    8) If your working with the asp_net databae, you ,may want to put that into your machine config.

    I have read about two or three other options for dealing with this problem.  I am not sure why it has become so cumbersome.   Hint - understand the error message before applying any changes.   Don't trust the blogs at face value. The flags are sent to the engine when started.  You can start a trace if it's still being problematic.

    Thursday, January 14, 2010 10:03 PM
  • User555306248 posted

     Any updates on this?

    Sunday, April 18, 2010 3:32 AM
  • User555306248 posted

    Please provide details 

    Monday, April 19, 2010 11:10 PM