none
EF6.X SqlException (0x80131904) - the user name or password is incorrect RRS feed

  • Question

  • I am in the process of converting a Razor Web Pages 3.X site with SQL Compact and EF to SQL Express with EF.

    Locally everything works OK, I can read from and update the db with traditional SQL or with EF.

    On the remote site (hosted at smarterasp.net) I have access to the db for read/write with traditional SQL, but when I use EF I get an error message as per below.

    The connection string must be ok, stumped as to why EF reports a username / password problem.

    <div>The user name or password is incorrect</div> <div></div> <div>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. </div> <div></div> <div>Exception Details: System.ComponentModel.Win32Exception: The user name or password is incorrect</div> <div></div> <div>Source Error: </div> <div></div> <div></div> <div>Line 38: if (isdemo) { demoid = Convert.ToInt16(Session["demoid"]); }</div> <div>Line 39: </div> <div>Line 40: var theProvider = dbContext.Providers</div> <div>Line 41: .Include("ProviderServices")</div> <div>Line 42: .Include("ShoeInventories")</div> <div></div> <div>Source File: h:\root\home\bi\www\bt\Members\EnF.cshtml Line: 40 </div> <div></div> <div>Stack Trace: </div> <div></div> <div></div> <div>[Win32Exception (0x80004005): The user name or password is incorrect]</div> <div></div> <div>[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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)]</div>

    Sunday, August 20, 2017 10:11 PM

All replies

  • Hi wavemaster00,

    According to your description, it seems that you could not connect remote SQL server express install, please try to the following steps and check if it works for you.

    Open SQL Server Configuration Manager. Select SQL Server Services. Locate the SQL Server instance you are using, right click and select Properties. On the FILESTREAM tab, select Allow remote clients access to FILESTREAM data.

    Best regards,

    Cole


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, August 21, 2017 5:03 AM
    Moderator
  • Turns out I had failed to change the connection string for Entity Framework to the one necessary to reach the db on the live server.

    Now have two EF connection strings: one for local and one for live.

    Monday, August 21, 2017 8:30 PM
  • Hi wvmstr,

    I am glad to know that resolve the issue and share the solution to us, please mark it as answer, it will be beneficial to other communities who have the similar issue.

    Best regards,

    Cole


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, August 22, 2017 12:50 AM
    Moderator