How to fix error occurred during the login process while using DevExpress Xpo

0

I'm using XPO as the ORM to connect to my database but every time it throws this error -

DevExpress.Xpo.DB.Exceptions.UnableToOpenDatabaseException: 'Unable to open database. Connection string: 'data source=localhost\SQLEXPRESS;user id=employee_user;password=REMOVED;initial catalog=Employee;Persist Security Info=true;'; Error: 'System.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the login process.

Here is my code -

using DevExpress.Xpo;
using DevExpress.Xpo.DB;
using System;
using System.Collections.Generic;
namespace XpoTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            XpoDefault.DataLayer = XpoDefault.GetDataLayer(MSSqlConnectionProvider
                .GetConnectionString("localhost\\SQLEXPRESS", "employee_user", "admin", "Employee"),
                AutoCreateOption.None);
            using (var cnn = new UnitOfWork())
            {
                var persons = new List<Person>();
                persons.Add(new Person(cnn) { FirstName = "First", LastName = "Name", Email = "hmm@domain.com" });
                cnn.CommitChanges();
                Console.WriteLine(persons[0].FirstName);
            }
            Console.WriteLine("End of stream.");
        }
    }
}

I have another Blazor application, where I used Dapper as the ORM, there I used the very same connection string and login credentials, and it worked. So what seems to be the problem here?

Here is the full exception message -

DevExpress.Xpo.DB.Exceptions.UnableToOpenDatabaseException: 'Unable to open database. Connection string: 'data source=localhost\SQLEXPRESS;user id=employee_user;password=***REMOVED***;initial catalog=Employee;Persist Security Info=true;'; Error: 'System.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)

---> System.ComponentModel.Win32Exception (233): No process is on the other end of the pipe.
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.Open()
   at DevExpress.Xpo.DB.MSSqlConnectionProvider.CreateDataBase(IDbConnection conn)
ClientConnectionId:a0c10b86-a8a3-4c1f-abf0-86a8c164f4f9
Error Number:233,State:0,Class:20''
c#
sql-server
devexpress
xpo
sql-server-2019-express
asked on Stack Overflow Dec 10, 2020 by Mahmudul Hasan

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0