Unable to Login & Register in ASP.NET MVC Application but Able to access other Data

0

Unable to connect to SQL & login in ASP.NET MVC web application.

But I am able to connect & retrieve all other data. Only login & register are not working. I don't know what's wrong.

Login:

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:

[Win32Exception (0x80004005): The system cannot find the file specified]

[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: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)]
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager) +1077
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +802

Other Controller

  • Able to add/edit/delete any records.

Connection String

metadata=res://*/CouriersHubEntity.csdl|res://*/CouriersHubEntity.ssdl|res://*/CouriersHubEntity.msl;provider=System.Data.SqlClient;provider connection string="Data Source=xx.xx.xx.xx;Initial Catalog=CouriersHubDB;Persist Security Info=True;User ID=xxxxxx;Password=hidden;App=EntityFramework"
c#
asp.net
sql-server
asp.net-mvc
entity-framework-6
asked on Stack Overflow Dec 10, 2018 by Aravin

1 Answer

-1

Your connection to sql server/database failed, please check your connectionstring, you can try to connect to sql server via management studio to make sure credentials are correct.

  • sometime we make a mistake by just putting local\dbserver in connectionstring, correct way is (localhost)\dbserver (sqlexpress or sqlserver in most cases)
answered on Stack Overflow Dec 10, 2018 by Altaf • edited Dec 10, 2018 by Altaf

User contributions licensed under CC BY-SA 3.0