Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Nenhuma conexão pôde ser feita porque a máquina de destino as recusou ativamente

Boa noite pessoal, não consigo fazer o Update-Databse toda vez que rodo o comando recebo o seguinte report: Update-Database Build started... Build succeeded. System.InvalidOperationException: An exception has been raised that is likely due to a transient failure. Consider enabling transient error resiliency by adding 'EnableRetryOnFailure()' to the 'UseMySql' call. ---> MySql.Data.MySqlClient.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts. ---> System.AggregateException: One or more errors occurred. (Nenhuma conexão pôde ser feita porque a máquina de destino as recusou ativamente.) ---> System.Net.Sockets.SocketException (10061): Nenhuma conexão pôde ser feita porque a máquina de destino as recusou ativamente. at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at System.Threading.Tasks.ValueTask.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state) --- End of stack trace from previous location --- at System.Net.Sockets.TcpClient.CompleteConnectAsync(Task task) --- End of inner exception stack trace --- at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout) at MySql.Data.Common.StreamCreator.GetTcpStream(MySqlConnectionStringBuilder settings, MyNetworkStream& networkStream) at MySql.Data.Common.StreamCreator.GetStream(MySqlConnectionStringBuilder settings, MyNetworkStream& networkStream) at MySql.Data.MySqlClient.NativeDriver.Open() at MySql.Data.MySqlClient.NativeDriver.Open() at MySql.Data.MySqlClient.Driver.Open() at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection() at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() at MySql.Data.MySqlClient.MySqlPool.GetConnection() at MySql.Data.MySqlClient.MySqlConnection.Open() at MySql.EntityFrameworkCore.MySQLDatabaseCreator.<>c__DisplayClass18_0.b__0(DateTime giveUp) at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.<>c__DisplayClass12_02.<Execute>b__0(DbContext c, TState s) at MySql.EntityFrameworkCore.Storage.Internal.MySQLExecutionStrategy.Execute[TState,TResult](TState state, Func3 operation, Func3 verifySucceeded) --- End of inner exception stack trace --- at MySql.EntityFrameworkCore.Storage.Internal.MySQLExecutionStrategy.Execute[TState,TResult](TState state, Func3 operation, Func3 verifySucceeded) at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.Execute[TState,TResult](IExecutionStrategy strategy, TState state, Func2 operation, Func2 verifySucceeded) at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.Execute[TState,TResult](IExecutionStrategy strategy, TState state, Func2 operation) at MySql.EntityFrameworkCore.MySQLDatabaseCreator.Exists(Boolean retryOnNotExists) at MySql.EntityFrameworkCore.MySQLDatabaseCreator.Exists() at Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.Exists() at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration) at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String connectionString, String contextType) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabaseImpl(String targetMigration, String connectionString, String contextType) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_0.<.ctor>b__0() at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action) An exception has been raised that is likely due to a transient failure. Consider enabling transient error resiliency by adding 'EnableRetryOnFailure()' to the 'UseMySql' call.

alguém tem ideia do que ta acontecendo?
2 respostas
solução!

Boa noite colega, comigo apresentou o mesmo erro, no meu caso o serviço do banco de dados MySQL não foi iniciado e não estava rodando na porta 3388. Se você utiliza Linux pode fazer o comando fuser 3388/tcp para verificar se há um processo utilizando essa porta. Eu inicializei o meu através do XAMPP.

Depois de iniciar o MySQL, eu reinicei o processo de Update-Database, daí me surgiu o seguinte erro: SSL Connection error. Então eu configurei a minha ConnectionString da seguinte forma:

"ConnectionStrings": { "VideoConnection" : "server=localhost;database=videoDb;user=root;password=root;SslMode=none;" }

Observe que eu coloquei o " SslMode=none; " no final. Caso ocorra com você já adianto a solução, comigo agora está funcionando perfeitamente.

Boa noite Gabriela! Era isso mesmo cara No meu caso deu o erro de SSL tbm, mas foi coisa de reconfigurar o MySQL mesmo Tu me ajudou muito Obrigado! ^^