how to fix The system cannot find the file specified error in ASP.NET MVC and sql server 2019


i create code first application but i running app receive this error and it doesnt make db

using sql server 2019 please help me i cant run

    Server Error in '/' Application.
The system cannot find the file 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.ComponentModel.Win32Exception: The system cannot find the file specified

Source Error:

Line 71:             // This doen't count login failures towards lockout only two factor authentication
Line 72:             // To enable password failures to trigger lockout, change to shouldLockout: true
Line 73:             var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout: false);
Line 74:             switch (result)
Line 75:             {

Source File: G:\MvcProject\OPA finally\OPA finally\Controllers\AccountController.cs    Line: 73

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, 
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4075.0

my connection string is true but i snot working web.config connection string code:

    <add name="DefaultConnection" connectionString="Data Source=.;Initial Catalog=DefaultConnection;Integrated Security=True;" providerName="System.Data.SqlClient" />

thank you for answer
asked on Stack Overflow May 12, 2020 by mohammadrahimi

1 Answer


First check SQL Server Agent is running. enter image description here

Most of the times it means that the connection string is incomplete. If you're not using Windows authentication, you need to provide uid=YourUserName; Password=yourpassword;. Check the logins in sql server db (Navigate to Security > Logins).

Otherwise try specifying Server name inside the connection string. If you have a named instance then you should set it like this i.e Server=localhost\sql2019

And also InitialCatalog is the name of the db. Is it "DefaultConnection"?

Also take a look at the properties in your db. enter image description here

answered on Stack Overflow May 12, 2020 by Indrit Kello • edited May 12, 2020 by Indrit Kello

User contributions licensed under CC BY-SA 3.0