Starts in:
2 DAYS
0 HR
37 MIN
57 SEC
Starts in:
2 D
0 H
37 M
57 S
Open Closed

Error Creating Database with 1st running of DBMigrator project #4758


User avatar
0
Spospisil created
  • ABP Framework version: v7.0.2
  • UI type: MVC
  • DB provider: EF Core/PostgreSQL
  • Tiered (MVC) or Identity Server Separated (Angular): Tiered/Separated Identity server
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

It seems that the 1st time I run the DBMigrator project I get errors related to a connection to the TestWebHost DB on the server.

Please advise.

[16:18:14 INF] Started database migrations... [16:18:14 INF] Migrating schema for host database... [16:18:16 ERR] An error occurred using the connection to database 'TestWebHost' on server ''. [16:18:17 ERR] 3D000: database "TestWebHost" does not exist Npgsql.PostgresException (0x80004005): 3D000: database "TestWebHost" does not exist at Npgsql.Internal.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|222_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) at Npgsql.Internal.NpgsqlConnector.<Open>g__OpenCore|204_1(NpgsqlConnector conn, SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken, Boolean isFirstAttempt) at Npgsql.Internal.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) at Npgsql.PoolingDataSource.OpenNewConnector(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) at Npgsql.PoolingDataSource.<Get>g__RentAsync|28_0(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlConnection.<Open>g__OpenAsync|45_0(Boolean async, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenAsync(CancellationToken cancellationToken, Boolean errorsExpected) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.BeginTransactionAsync(IsolationLevel isolationLevel, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.BeginTransactionAsync(CancellationToken cancellationToken) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.CreateDbContextWithTransactionAsync(IUnitOfWork unitOfWork) in C:\Src702\ABP\framework\src\Volo.Abp.EntityFrameworkCore\Volo\Abp\Uow\EntityFrameworkCore\UnitOfWorkDbContextProvider.cs:line 272 at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.CreateDbContextAsync(IUnitOfWork unitOfWork) in C:\Src702\ABP\framework\src\Volo.Abp.EntityFrameworkCore\Volo\Abp\Uow\EntityFrameworkCore\UnitOfWorkDbContextProvider.cs:line 160 at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.CreateDbContextAsync(IUnitOfWork unitOfWork, String connectionStringName, String connectionString) in C:\Src702\ABP\framework\src\Volo.Abp.EntityFrameworkCore\Volo\Abp\Uow\EntityFrameworkCore\UnitOfWorkDbContextProvider.cs:line 135 at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.GetDbContextAsync() at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository2.GetDbSetAsync() in C:\Src702\ABP\framework\src\Volo.Abp.EntityFrameworkCore\Volo\Abp\Domain\Repositories\EntityFrameworkCore\EfCoreRepository.cs:line 74 at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository2.GetListAsync(Boolean includeDetails, CancellationToken cancellationToken) in C:\Src702\ABP\framework\src\Volo.Abp.EntityFrameworkCore\Volo\Abp\Domain\Repositories\EntityFrameworkCore\EfCoreRepository.cs:line 226 at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() in C:\Src702\ABP\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAbpMethodInvocationAdapterWithReturnValue.cs:line 24 at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) in C:\Src702\ABP\framework\src\Volo.Abp.Uow\Volo\Abp\Uow\UnitOfWorkInterceptor.cs:line 49 at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) in C:\Src702\ABP\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAsyncAbpInterceptorAdapter.cs:line 29 at Volo.Abp.FeatureManagement.StaticFeatureSaver.UpdateChangedFeatureGroupsAsync(IEnumerable1 featureGroupRecords) in C:\Src702\ABP\modules\feature-management\src\Volo.Abp.FeatureManagement.Domain\Volo\Abp\FeatureManagement\StaticFeatureSaver.cs:line 134 at Volo.Abp.FeatureManagement.StaticFeatureSaver.SaveAsync() in C:\Src702\ABP\modules\feature-management\src\Volo.Abp.FeatureManagement.Domain\Volo\Abp\FeatureManagement\StaticFeatureSaver.cs:line 102 at Volo.Abp.FeatureManagement.StaticFeatureSaver.SaveAsync() in C:\Src702\ABP\modules\feature-management\src\Volo.Abp.FeatureManagement.Domain\Volo\Abp\FeatureManagement\StaticFeatureSaver.cs:line 116 at Volo.Abp.FeatureManagement.StaticFeatureSaver.SaveAsync() in C:\Src702\ABP\modules\feature-management\src\Volo.Abp.FeatureManagement.Domain\Volo\Abp\FeatureManagement\StaticFeatureSaver.cs:line 118 at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() in C:\Src702\ABP\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAbpMethodInvocationAdapter.cs:line 23 at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) in C:\Src702\ABP\framework\src\Volo.Abp.Uow\Volo\Abp\Uow\UnitOfWorkInterceptor.cs:line 49 at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) in C:\Src702\ABP\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAsyncAbpInterceptorAdapter.cs:line 20 at Volo.Abp.FeatureManagement.AbpFeatureManagementDomainModule.<>c__DisplayClass6_0.<<SaveStaticFeaturesToDatabaseAsync>b__1>d.MoveNext() in C:\Src702\ABP\modules\feature-management\src\Volo.Abp.FeatureManagement.Domain\Volo\Abp\FeatureManagement\AbpFeatureManagementDomainModule.cs:line 136


5 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Is this the same project? https://support.abp.io/QA/Questions/4757#answer-3a0a1e3d-ffe7-74aa-7c3b-481f97bdacf5

    Please try again after fixing it.

  • User Avatar
    0
    Spospisil created

    Hi,

    No it is not the same issue as the other support ticket I created. Once I did apply the fix for that one it still did not fix my issue with this one. Here's an update error message that I'm getting.

    [06:13:33 INF] Started database migrations... [06:13:33 INF] Migrating schema for host database... [06:13:35 ERR] An error occurred using the connection to database 'TestWebHost' on server ''. [06:13:36 ERR] 3D000: database "TestWebHost" does not exist Npgsql.PostgresException (0x80004005): 3D000: database "TestWebHost" does not exist at Npgsql.Internal.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|222_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) at Npgsql.Internal.NpgsqlConnector.<Open>g__OpenCore|204_1(NpgsqlConnector conn, SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken, Boolean isFirstAttempt) at Npgsql.Internal.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) at Npgsql.PoolingDataSource.OpenNewConnector(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) at Npgsql.PoolingDataSource.<Get>g__RentAsync|28_0(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlConnection.<Open>g__OpenAsync|45_0(Boolean async, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenAsync(CancellationToken cancellationToken, Boolean errorsExpected) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.BeginTransactionAsync(IsolationLevel isolationLevel, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.BeginTransactionAsync(CancellationToken cancellationToken) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.CreateDbContextWithTransactionAsync(IUnitOfWork unitOfWork) in C:\Src702\ABP\framework\src\Volo.Abp.EntityFrameworkCore\Volo\Abp\Uow\EntityFrameworkCore\UnitOfWorkDbContextProvider.cs:line 272 at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.CreateDbContextAsync(IUnitOfWork unitOfWork) in C:\Src702\ABP\framework\src\Volo.Abp.EntityFrameworkCore\Volo\Abp\Uow\EntityFrameworkCore\UnitOfWorkDbContextProvider.cs:line 160 at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.CreateDbContextAsync(IUnitOfWork unitOfWork, String connectionStringName, String connectionString) in C:\Src702\ABP\framework\src\Volo.Abp.EntityFrameworkCore\Volo\Abp\Uow\EntityFrameworkCore\UnitOfWorkDbContextProvider.cs:line 135 at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.GetDbContextAsync() at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository2.GetDbSetAsync() in C:\Src702\ABP\framework\src\Volo.Abp.EntityFrameworkCore\Volo\Abp\Domain\Repositories\EntityFrameworkCore\EfCoreRepository.cs:line 74 at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository2.GetListAsync(Boolean includeDetails, CancellationToken cancellationToken) in C:\Src702\ABP\framework\src\Volo.Abp.EntityFrameworkCore\Volo\Abp\Domain\Repositories\EntityFrameworkCore\EfCoreRepository.cs:line 226 at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() in C:\Src702\ABP\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAbpMethodInvocationAdapterWithReturnValue.cs:line 24 at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) in C:\Src702\ABP\framework\src\Volo.Abp.Uow\Volo\Abp\Uow\UnitOfWorkInterceptor.cs:line 49 at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) in C:\Src702\ABP\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAsyncAbpInterceptorAdapter.cs:line 29 at Volo.Abp.PermissionManagement.StaticPermissionSaver.UpdateChangedPermissionGroupsAsync(IEnumerable1 permissionGroupRecords) in C:\Src702\ABP\modules\permission-management\src\Volo.Abp.PermissionManagement.Domain\Volo\Abp\PermissionManagement\StaticPermissionSaver.cs:line 134 at Volo.Abp.PermissionManagement.StaticPermissionSaver.SaveAsync() in C:\Src702\ABP\modules\permission-management\src\Volo.Abp.PermissionManagement.Domain\Volo\Abp\PermissionManagement\StaticPermissionSaver.cs:line 102 at Volo.Abp.PermissionManagement.StaticPermissionSaver.SaveAsync() in C:\Src702\ABP\modules\permission-management\src\Volo.Abp.PermissionManagement.Domain\Volo\Abp\PermissionManagement\StaticPermissionSaver.cs:line 116 at Volo.Abp.PermissionManagement.StaticPermissionSaver.SaveAsync() in C:\Src702\ABP\modules\permission-management\src\Volo.Abp.PermissionManagement.Domain\Volo\Abp\PermissionManagement\StaticPermissionSaver.cs:line 118 at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() in C:\Src702\ABP\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAbpMethodInvocationAdapter.cs:line 23 at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) in C:\Src702\ABP\framework\src\Volo.Abp.Uow\Volo\Abp\Uow\UnitOfWorkInterceptor.cs:line 49 at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) in C:\Src702\ABP\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAsyncAbpInterceptorAdapter.cs:line 20 at Volo.Abp.PermissionManagement.AbpPermissionManagementDomainModule.<>c__DisplayClass6_0.<<SaveStaticPermissionsToDatabaseAsync>b__1>d.MoveNext() in C:\Src702\ABP\modules\permission-management\src\Volo.Abp.PermissionManagement.Domain\Volo\Abp\PermissionManagement\AbpPermissionManagementDomainModule.cs:line 122 --- End of stack trace from previous location --- at Polly.AsyncPolicy.<>c__DisplayClass40_0.<<ImplementationAsync>b__0>d.MoveNext() --- End of stack trace from previous location --- at Polly.Retry.AsyncRetryEngine.ImplementationAsync[TResult](Func3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates1 shouldRetryResultPredicates, Func5 onRetryAsync, Int32 permittedRetryCount, IEnumerable1 sleepDurationsEnumerable, Func`4 sleepDurationProvider, Boolean continueOnCapturedContext) Exception data: Severity: FATAL SqlState: 3D000 MessageText: database "TestWebHost" does not exist File: postinit.c Line: 887 Routine: InitPostgres [06:13:36 ERR] ---------- Exception Data ---------- Severity = FATAL InvariantSeverity = FATAL SqlState = 3D000 MessageText = database "TestWebHost" does not exist File = postinit.c Line = 887 Routine = InitPostgres

    [06:13:39 ERR] An error occurred using the connection to database 'TestWebHost' on server ''. [06:13:39 ERR] An error occurred using the connection to database 'TestWebHost' on server ''. [06:13:44 ERR] 3D000: database "TestWebHost" does not exist Npgsql.PostgresException (0x80004005): 3D000: database "TestWebHost" does not exist at Npgsql.Internal.NpgsqlConnector.

  • User Avatar
    0
    Spospisil created

    Any suggestions?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Try using AddDataMigrationEnvironment on your DbMigrator project.

    https://github.com/abpframework/abp/blob/dev/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator/DbMigratorHostedService.cs#L31

  • User Avatar
    0
    Spospisil created

    Hi,

    That appears to have resolved the issue.

    Thank you.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06