locked
Problem login RRS feed

  • Question

  • User1331569570 posted

    The site is working well local but when i publish it i can not login, i get this error:

    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 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. 

    SQLExpress database file auto-creation error: 


    The connection string specifies a local Sql Server Express instance using a database location within the applications App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:


    If the applications App_Data directory does not already exist, the web server account must have read and write access to the applications directory. This is necessary because the web server account will automatically create the App_Data directory if it does not already exist. 
    If the applications App_Data directory already exists, the web server account only requires read and write access to the applications App_Data directory. This is necessary because the web server account will attempt to verify that the Sql Server Express database already exists within the applications App_Data directory. Revoking read access on the App_Data directory from the web server account will prevent the provider from correctly determining if the Sql Server Express database already exists. This will cause an error when the provider attempts to create a duplicate of an already existing database. Write access is required because the web server accounts credentials are used when creating the new database. 
    Sql Server Express must be installed on the machine. 
    The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts. 


    Source Error: 

    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) +4846887
      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) +4860189
      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) +4861315
      System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +29
      System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +4863644
      System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
      System.Data.SqlClient.SqlConnection.Open() +122
      System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +82

    [HttpException (0x80004005): Unable to connect to SQL Server database.]
      System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +137
      System.Web.Management.SqlServices.SetupApplicationServices(String server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install) +94
      System.Web.Management.SqlServices.Install(String database, String dbFileName, String connectionString) +25
      System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName, String dataDir, String connectionString) +395

     

    I don't know why it asking for App_data, the connection string is working fine and showing news etc  from the db.

    Any idea?
     

    Saturday, May 1, 2010 1:52 PM

Answers

  • User1759999623 posted

    The standard security configuration uses the LocalSqlServer connection string for connecting to the ASPNETDB database that is created when you configure your web application to use the built-in security/membership functionality from .NET.

    If you're using a connection string that is already connected to your own ASPNETDB database, then in your web.config under <connectionStrings), remove LocalSqlServer and then add LocalSqlServer to set your own ASPNETDB database.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, May 1, 2010 5:55 PM

All replies

  • User1759999623 posted

    The standard security configuration uses the LocalSqlServer connection string for connecting to the ASPNETDB database that is created when you configure your web application to use the built-in security/membership functionality from .NET.

    If you're using a connection string that is already connected to your own ASPNETDB database, then in your web.config under <connectionStrings), remove LocalSqlServer and then add LocalSqlServer to set your own ASPNETDB database.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, May 1, 2010 5:55 PM
  • User1331569570 posted

    Thank you. Now im able to register new user, but when im login then nothing happen. 

    Im putting in username and password, push login, and then nothing happen..


    What can be wrong? 

    Sunday, May 2, 2010 6:39 AM
  • User1759999623 posted

    I stand corrected; the default database for the Club Starter Kit has a connection string with the name of ClubSiteDB.

    When you published the Club site, was this to a host or your own production server?  Are you using the default database settings as is, or did you make changes to them?  Please outline your database setup for both locally and for your published site?

    Sunday, May 2, 2010 9:06 AM
  • User1331569570 posted

    The site is published to a host, i have not make any changes to the database. The database is just published to the host, and this is the connectionstring:

    <connectionStrings>
      <add name="ClubSiteDB" connectionString="Data Source=msdb5.surftown.no;Initial Catalog=kbsdesi_clubDB;User ID=kbsdesi_kenneth;Password=playboy;Trusted_Connection=False" providerName="System.Data.SqlClient" />
      <remove name="LocalSqlServer"/>
      <add name="LocalSqlServer" connectionString="Data Source=msdb5.surftown.no;Initial Catalog=kbsdesi_clubDB;User ID=kbsdesi_kenneth;Password=playboy;Trusted_Connection=False" providerName="System.Data.SqlClient" />
      </connectionStrings>

    It works fine with showing news etc that was in the database before publishing, and it works with register new user. But when i try to login this new user, nothing happend, but if i try wrong password, then i get this message: Your login attempt was not successful. Please try again. 

    Sunday, May 2, 2010 10:40 AM
  • User1759999623 posted

    You can remove the LocalSqlServer references and just leave the ClubSiteDB.

    Can you provide some code for your login process? 

    Sunday, May 2, 2010 5:11 PM
  • User1331569570 posted

    Before i add the LocalSqlServer refrence i was'nt able to register a new user, after i add it it works to register new users, i find them in the db.


    I sent you a mail, maybe its easier if you see all the files? 

    Tuesday, May 4, 2010 4:42 AM
  • User1331569570 posted

     If i remove the LocalSqlServer refrence, so the connection string is like this:

    <connectionStrings>
      <add name="ClubSiteDB" connectionString="Data Source=msdb5.surftown.no;Initial Catalog=kbsdesi_clubDB;User ID=kbsdesi_kenneth;Password=playboy;Trusted_Connection=False" providerName="System.Data.SqlClient" />
       
      </connectionStrings>

    I get this error:

    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 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. 

    SQLExpress database file auto-creation error: 


    The connection string specifies a local Sql Server Express instance using a database location within the applications App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:


    If the applications App_Data directory does not already exist, the web server account must have read and write access to the applications directory. This is necessary because the web server account will automatically create the App_Data directory if it does not already exist. 
    If the applications App_Data directory already exists, the web server account only requires read and write access to the applications App_Data directory. This is necessary because the web server account will attempt to verify that the Sql Server Express database already exists within the applications App_Data directory. Revoking read access on the App_Data directory from the web server account will prevent the provider from correctly determining if the Sql Server Express database already exists. This will cause an error when the provider attempts to create a duplicate of an already existing database. Write access is required because the web server accounts credentials are used when creating the new database. 
    Sql Server Express must be installed on the machine. 
    The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts. 


    Source Error: 

    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) +4846887
      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) +4860189
      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) +4861315
      System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +29
      System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +4863644
      System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
      System.Data.SqlClient.SqlConnection.Open() +122
      System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +82

    [HttpException (0x80004005): Unable to connect to SQL Server database.]
      System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +137
      System.Web.Management.SqlServices.SetupApplicationServices(String server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install) +94
      System.Web.Management.SqlServices.Install(String database, String dbFileName, String connectionString) +25
      System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName, String dataDir, String connectionString) +395

     


     

    Tuesday, May 4, 2010 6:01 AM
  • User1759999623 posted

    I believe that this comes down to that you are not able to connect to your database.  Now, as I understand your issue, in your development environment using this same connection string, you were able to connect to the database. However, when you try to connect from your production site using this same connection string, you are getting the error message above.

    If this is the case, then you need to verify that you do not have a firewall in between your production server and your database server.  Specifically, you need to have the port for SQL Server open so that the website can communicate with the database. 

    Tuesday, May 4, 2010 12:29 PM
  • User1331569570 posted

     But it looks like i have connection with the database, text that i put in the database when i make it shows on the site as it should be now when it is online. Both the side and the db is published to a web host. When i register new useres i find them in the database, so i can write to the database, then i must have a connection with the db?

    If i write wrong password then i get an error message, but if i write correct password, then nothing happend.

    Is it easier for you if you see the files and database?

    My email is bergekenneth (a) hotmail.com

    Tuesday, May 4, 2010 12:37 PM