locked
Error: The system cannot find the file specified - Connection String confusion RRS feed

  • Question

  • User-2006371901 posted

    I have an MVC5 app, uses Aspnet Identity provider, when I try logging in to a page, I get "The system cannot find the file specified " , further more it is pointing to sql > [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. 

    Checking thru online resources, connection string may be the issue, I am using remote SQL server, I commented out the reference to LocalDB, but still get the error

    connection string in webconfig :

    <connectionStrings>
    <!-- <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-MyProj-20191016092040.mdf;Initial Catalog=aspnet-MyProj-20191016092040;Integrated Security=True" providerName="System.Data.SqlClient" />-->

    <add name="MyDBASEEntities" connectionString="Data Source=myserver.net;initial catalog=MyDBASE;persist security info=True;user id=Sales123;password=zzzzzz;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    </connectionStrings>

    the "The system cannot find the file specified " error is pointing to the line in my accountcontroller >

    Line 76: // This doesn't count login failures towards account lockout
    Line 77: // To enable password failures to trigger account lockout, change to shouldLockout: true
    Line 78: var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout: false);
    Line 79: switch (result)
    Line 80: { ..
    [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.

    ??
    Ned

    Tuesday, October 29, 2019 6:21 PM

All replies

  • User475983607 posted

    The error means the connection string is wrong.  Are you sure the connection string is not hard coded somewhere in your code base?  Or perhaps you forgot to change form "DefaultConnection" to "MyDBASEEntities"?

    Take a moment to review your code.

    Tuesday, October 29, 2019 6:40 PM
  • User1120430333 posted

    Either the connectionstring is wrong,  or MS SQL Server running on a remote computer is not configured for remote connections.

    Tuesday, October 29, 2019 8:38 PM