Open Closed

OpenIddict and web public Npgsql.NpgsqlException error #7561


User avatar
0
mehmet.kocak created
  • ABP Framework version: v8.1.4
  • UI Type: MVC
  • Database System: EF Core (PostgreSQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular):NOT Tiered
  • Exception message and full stack trace: Web layer azure kudu

Hello I get an error while deploy to azure web app ı follow this ; https://medium.com/abp-community/abp-framework-goes-azure-4b01b331d201

here is the details;

2024-07-24 13:24:53.295 +00:00 [INF] Starting web host. 2024-07-24 13:25:02.453 +00:00 [FTL] Host terminated unexpectedly! Volo.Abp.AbpInitializationException: An error occurred during ConfigureServicesAsync phase of the module Volo.Abp.OpenIddict.AbpOpenIddictAspNetCoreModule, Volo.Abp.OpenIddict.AspNetCore, Version=8.1.4.0, Culture=neutral, PublicKeyToken=null. See the inner exception for details. ---> System.IO.FileNotFoundException: Signing Certificate couldn't found: openiddict.pfx at Microsoft.Extensions.DependencyInjection.OpenIddictServerBuilderExtensions.AddProductionEncryptionAndSigningCertificate(OpenIddictServerBuilder builder, String fileName, String passPhrase) at Tdv.Dbys.Web.DbysWebModule.<>c.b__0_3(OpenIddictServerBuilder serverBuilder) in /home/vsts/work/1/s/src/Tdv.Dbys.Web/DbysWebModule.cs:line 134 at Volo.Abp.Options.PreConfigureActionList1.Configure(TOptions options) at Microsoft.Extensions.DependencyInjection.ServiceCollectionPreConfigureExtensions.ExecutePreConfiguredActions[TOptions](IServiceCollection services, TOptions options) at Volo.Abp.OpenIddict.AbpOpenIddictAspNetCoreModule.<>c__DisplayClass1_0.<AddOpenIddictServer>b__0(OpenIddictServerBuilder builder) at Microsoft.Extensions.DependencyInjection.OpenIddictServerExtensions.AddServer(OpenIddictBuilder builder, Action1 configuration) at Volo.Abp.OpenIddict.AbpOpenIddictAspNetCoreModule.AddOpenIddictServer(IServiceCollection services) at Volo.Abp.OpenIddict.AbpOpenIddictAspNetCoreModule.ConfigureServices(ServiceConfigurationContext context) at Volo.Abp.Modularity.AbpModule.ConfigureServicesAsync(ServiceConfigurationContext context) at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync() --- End of inner exception stack trace --- at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync() at Volo.Abp.AbpApplicationFactory.CreateAsync[TStartupModule](IServiceCollection services, Action1 optionsAction) at Microsoft.Extensions.DependencyInjection.ServiceCollectionApplicationExtensions.AddApplicationAsync[TStartupModule](IServiceCollection services, Action1 optionsAction) at Microsoft.Extensions.DependencyInjection.WebApplicationBuilderExtensions.AddApplicationAsync[TStartupModule](WebApplicationBuilder builder, Action1 optionsAction) at Tdv.Dbys.Web.Program.Main(String[] args) in /home/vsts/work/1/s/src/Tdv.Dbys.Web/Program.cs:line 36 2024-07-24 13:33:31.934 +00:00 [INF] Starting web host. 2024-07-24 13:33:41.892 +00:00 [FTL] Host terminated unexpectedly! Volo.Abp.AbpInitializationException: An error occurred during ConfigureServicesAsync phase of the module Volo.Abp.OpenIddict.AbpOpenIddictAspNetCoreModule, Volo.Abp.OpenIddict.AspNetCore, Version=8.1.4.0, Culture=neutral, PublicKeyToken=null. See the inner exception for details. ---> System.IO.FileNotFoundException: Signing Certificate couldn't found: openiddict.pfx at Microsoft.Extensions.DependencyInjection.OpenIddictServerBuilderExtensions.AddProductionEncryptionAndSigningCertificate(OpenIddictServerBuilder builder, String fileName, String passPhrase) at Tdv.Dbys.Web.DbysWebModule.<>c.<PreConfigureServices>b__0_3(OpenIddictServerBuilder serverBuilder) in /home/vsts/work/1/s/src/Tdv.Dbys.Web/DbysWebModule.cs:line 134 at Volo.Abp.Options.PreConfigureActionList1.Configure(TOptions options) at Microsoft.Extensions.DependencyInjection.ServiceCollectionPreConfigureExtensions.ExecutePreConfiguredActions[TOptions](IServiceCollection services, TOptions options) at Volo.Abp.OpenIddict.AbpOpenIddictAspNetCoreModule.<>c__DisplayClass1_0.b__0(OpenIddictServerBuilder builder) at Microsoft.Extensions.DependencyInjection.OpenIddictServerExtensions.AddServer(OpenIddictBuilder builder, Action1 configuration) at Volo.Abp.OpenIddict.AbpOpenIddictAspNetCoreModule.AddOpenIddictServer(IServiceCollection services) at Volo.Abp.OpenIddict.AbpOpenIddictAspNetCoreModule.ConfigureServices(ServiceConfigurationContext context) at Volo.Abp.Modularity.AbpModule.ConfigureServicesAsync(ServiceConfigurationContext context) at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync() --- End of inner exception stack trace --- at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync() at Volo.Abp.AbpApplicationFactory.CreateAsync[TStartupModule](IServiceCollection services, Action1 optionsAction) at Microsoft.Extensions.DependencyInjection.ServiceCollectionApplicationExtensions.AddApplicationAsync[TStartupModule](IServiceCollection services, Action1 optionsAction) at Microsoft.Extensions.DependencyInjection.WebApplicationBuilderExtensions.AddApplicationAsync[TStartupModule](WebApplicationBuilder builder, Action1 optionsAction) at Tdv.Dbys.Web.Program.Main(String[] args) in /home/vsts/work/1/s/src/Tdv.Dbys.Web/Program.cs:line 36

web public layer kudu 2024-07-24 13:38:53.994 +00:00 [ERR] An error occurred using the connection to database 'abpiodemodb' on server 'tcp://abp-io-postgresql.postgres.database.azure.com:5432'. 2024-07-24 13:38:54.025 +00:00 [ERR] Failed to connect to 172.201.47.112:5432 Npgsql.NpgsqlException (0x80004005): Failed to connect to 172.201.47.112:5432 ---> System.TimeoutException: The operation has timed out. at Npgsql.TaskTimeoutAndCancellation.ExecuteAsync(Func2 getTaskFunc, NpgsqlTimeout timeout, CancellationToken cancellationToken) at Npgsql.Internal.NpgsqlConnector.ConnectAsync(NpgsqlTimeout timeout, CancellationToken cancellationToken) at Npgsql.Internal.NpgsqlConnector.ConnectAsync(NpgsqlTimeout timeout, CancellationToken cancellationToken) at Npgsql.Internal.NpgsqlConnector.RawOpen(SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken, Boolean isFirstAttempt) at Npgsql.Internal.NpgsqlConnector.<Open>g__OpenCore|213_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|34_0(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlConnection.<Open>g__OpenAsync|42_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) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.CreateDbContextAsync(IUnitOfWork unitOfWork) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.CreateDbContextAsync(IUnitOfWork unitOfWork, String connectionStringName, String connectionString) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.GetDbContextAsync() at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository2.GetDbSetAsync() at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository2.GetQueryableAsync() at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository2.GetListAsync(Boolean includeDetails, CancellationToken cancellationToken) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.TextTemplateManagement.TextTemplates.StaticTextTemplateSaver.UpdateChangedTemplatesAsync(Dictionary2 templateRecords) at Volo.Abp.TextTemplateManagement.TextTemplates.StaticTextTemplateSaver.SaveAsync() at Volo.Abp.TextTemplateManagement.TextTemplates.StaticTextTemplateSaver.SaveAsync() at Volo.Abp.TextTemplateManagement.TextTemplates.StaticTextTemplateSaver.SaveAsync() at Volo.Abp.TextTemplateManagement.TextTemplates.StaticTextTemplateSaver.SaveAsync() at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.TextTemplateManagement.TextTemplateManagementDomainModule.<>c__DisplayClass8_0.<b__1>d.MoveNext() --- End of stack trace from previous location --- at Polly.AsyncPolicy.<>c__DisplayClass40_0.<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)

  • Steps to reproduce the issue:
  1. I compile the application with build pipeline YAML and deploy it to Azure Web App with releases.
  2. I previously ran the migration layer in my local environment and created the database settings.
  3. I have not done any development on the application. I create it with ABP Suite and try to publish it without any development.
  • web layer error.
  • web public layer

Build yaml file trigger:

  • master

pool: vmImage: ubuntu-latest

variables: buildConfiguration: 'Release'

steps:

  • task: UseDotNet@2 inputs: packageType: 'sdk' version: '8.x'
  • script: | dotnet --version displayName: 'Check .NET Core Version'
  • script: | dotnet build --configuration $(buildConfiguration) displayName: 'Build with dotnet'
  • task: DotNetCoreCLI@2 displayName: 'Publish Mvc Project' inputs: command: 'publish' projects: '**/Tdv.Dbys.sln' arguments: '--configuration $(buildConfiguration) --output $(build.artifactStagingDirectory)'
  • script: | dotnet dev-certs https -v -ep openiddict.pfx -p 6a7aac55-a556-46bc-9b6a-cbf4f494e4f9 displayName: 'Generate openiddict.pfx' workingDirectory: 'src/Tdv.Dbys.Web'
  • task: PublishPipelineArtifact@1 displayName: 'Publish Artifacts' inputs: targetPath: '$(build.artifactStagingDirectory)' artifact: 'drop' publishLocation: 'pipeline'


3 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Signing Certificate couldn't found: openiddict.pfx

    See https://github.com/bartvanhoey/AbpGoesAzure/blob/main/tutorial/7.deployment-succeeded-web-app-not-working-fix-the-issues.md#generate-the-openiddictpfx-certificate

  • User Avatar
    0
    mehmet.kocak created

    Hi, I made the changes you said, but I still get the same error. I have an empty abp project. I can forward the project to you if you like.

    I share the picture of the layers.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi

    Can you check these? they are some related questions

    • https://abp.io/support/questions/5446/Missing-AuthServerpfx-when-deployed-to-Azure
    • https://abp.io/support/questions/7243/authserverpfx-file-can't-be-found
    • https://abp.io/docs/latest/Deployment/Configuring-OpenIddict#production-environment
Made with ❤️ on ABP v9.1.0-preview. Updated on December 12, 2024, 07:15