Ends in:
7 DAYS
21 HRS
43 MIN
31 SEC
Ends in:
7 D
21 H
43 M
31 S
Open Closed

ABP IIS Hosting Problem #8088


User avatar
0
koraykirdinli created

Hi, We are trying to publish our abp api host project to IIS. We got HTP 500.30 and our project cannot be opened. What can be the problem.

HTTP Error 500.30 - ASP.NET Core app failed to start Common solutions to this issue: The app failed to start The app started but then stopped The app started but threw an exception during startup Troubleshooting steps: Check the system event log for error messages Enable logging the application process' stdout messages Attach a debugger to the application process and inspect For more guidance on diagnosing and handling these errors, visit Troubleshoot ASP.NET Core on Azure App Service and IIS.


35 Answer(s)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello ,

    Please check similar issue https://abp.io/support/questions/8057/Issue-uploading-to-hosting-platform-IIS-based#answer-3a1583fc-9a96-cce3-d4e4-2a3efde76f65

    Thanks,

  • User Avatar
    0
    koraykirdinli created

    Yes I check the issues and install openiddict.pfx certificate. My appsettings is below.

    EventLogs

    Application '/LM/W3SVC/2/ROOT' with physical root 'C:\inetpub\wwwroot\PayosGate\PayosGateApi' has exited from Program.Main with exit code = '1'. Please check the stderr logs for more information.

    Application '/LM/W3SVC/2/ROOT' with physical root 'C:\inetpub\wwwroot\PayosGate\PayosGateApi' failed to load coreclr. Exception message: CLR worker thread exited prematurely

    Process C:\Windows\System32\WUDFHost.exe (process ID:4156) reset policy scheme from {381b4222-f694-41f0-9685-ff5bb260df2e} to {381b4222-f694-41f0-9685-ff5bb260df2e}

    I change the port, change the release mode portable or x64,update the nuget packages, I try lots of options but still got the error. I publish a .NET Core 8.0 test application, my project has run, but abp project not. Can we make an online call to fix the issue

  • User Avatar
    0
    koraykirdinli created

    It is urgent topic, please help us. We also create our 8.0 solution from ABP.Suite but when I publish it to my local iis it also gets 500.30 error. I suppose 8.0 version is not stable. 7.0 is also working.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi koraykirdinli

    Please enable the stdout logs and share it.

    Thanks.

    https://learn.microsoft.com/en-us/aspnet/core/test/troubleshoot-azure-iis?view=aspnetcore-8.0#aspnet-core-module-stdout-log-iis

  • User Avatar
    0
    koraykirdinli created

    I also open stdout logs , log file has been created but it is empty

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Have you created the openiddict.pfx file in the website?


    Before running the application

    Generating a Signing Certificate

    In the production environment, you need to use a production signing certificate. ABP Framework sets up signing and encryption certificates in your application and expects an openiddict.pfx file in your application.

    This certificate is already generated by ABP CLI, so most of the time you don't need to generate it yourself. However, if you need to generate a certificate, you can use the following command:

    dotnet dev-certs https -v -ep openiddict.pfx -p 00000000-0000-0000-0000-000000000000
    

    00000000-0000-0000-0000-000000000000 is the password of the certificate, you can change it to any password you want.

    It is recommended to use two RSA certificates, distinct from the certificate(s) used for HTTPS: one for encryption, one for signing.

    For more information, please refer to: https://documentation.openiddict.com/configuration/encryption-and-signing-credentials.html#registering-a-certificate-recommended-for-production-ready-scenarios

    Also, see the Configuring OpenIddict documentation for more information.

        public override void PreConfigureServices(ServiceConfigurationContext context)
        {
            var hostingEnvironment = context.Services.GetHostingEnvironment();
            var configuration = context.Services.GetConfiguration();
    
            PreConfigure<OpenIddictBuilder>(builder =>
            {
                builder.AddValidation(options =>
                {
                    options.AddAudiences("MyProjectName");
                    options.UseLocalServer();
                    options.UseAspNetCore();
                });
            });
    
            if (!hostingEnvironment.IsDevelopment())
            {
                PreConfigure<AbpOpenIddictAspNetCoreOptions>(options =>
                {
                    options.AddDevelopmentEncryptionAndSigningCertificate = false;
                });
    
                PreConfigure<OpenIddictServerBuilder>(serverBuilder =>
                {
                    serverBuilder.AddProductionEncryptionAndSigningCertificate("openiddict.pfx", "00000000-0000-0000-0000-000000000000");
                });
            }
        }
    
  • User Avatar
    0
    koraykirdinli created

    It does not work. Can you connect my desktop,

    AnyDesk Code : 1 867 337 541

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    ok,

  • User Avatar
    0
    koraykirdinli created

    If you want I can send you an invitation, send me your id. Your request has not reach to me

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    liming.ma@volosoft.com

  • User Avatar
    0
    koraykirdinli created

    Do you have any desk

    First we can make a teams call : https://teams.live.com/meet/9451437043424?p=xV325AFhbbWlwpTvlb

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you join zoom(with zoom client) and share your screen?

    I will check your IIS.

    https://us05web.zoom.us/j/87104048130?pwd=iIWFM5XvS1bWC3G5Xq85W0bNqmW60n.1

  • User Avatar
    0
    koraykirdinli created

    I am waiting for your accept

  • User Avatar
    0
    koraykirdinli created
     dotnet dev-certs https -v -ep openiddict.pfx -p 00000000-0000-0000-0000-000000000000
    [1] Listing certificates from CurrentUser\My
    [2] Found certificates: 1 certificate
        1) 193B08B2C754BE796AFE64856FE863FD339EB078 - CN=localhost - Valid from 2024-05-15 00:07:34Z to 2025-05-15 00:07:34Z - IsHttpsDevelopmentCertificate: true - IsExportable: true
    [3] Checking certificates validity
    [4] Valid certificates: 1 certificate
        1) 193B08B2C754BE796AFE64856FE863FD339EB078 - CN=localhost - Valid from 2024-05-15 00:07:34Z to 2025-05-15 00:07:34Z - IsHttpsDevelopmentCertificate: true - IsExportable: true
    [5] Invalid certificates: no certificates
    [6] Finished listing certificates.
    [1] Listing certificates from LocalMachine\My
    [2] Found certificates: 1 certificate
        1) 193B08B2C754BE796AFE64856FE863FD339EB078 - CN=localhost - Valid from 2024-05-15 00:07:34Z to 2025-05-15 00:07:34Z - IsHttpsDevelopmentCertificate: true - IsExportable: true
    [3] Checking certificates validity
    [4] Valid certificates: 1 certificate
        1) 193B08B2C754BE796AFE64856FE863FD339EB078 - CN=localhost - Valid from 2024-05-15 00:07:34Z to 2025-05-15 00:07:34Z - IsHttpsDevelopmentCertificate: true - IsExportable: true
    [5] Invalid certificates: no certificates
    [6] Finished listing certificates.
    [8] Filtered certificates: 2 certificates
        1) 193B08B2C754BE796AFE64856FE863FD339EB078 - CN=localhost - Valid from 2024-05-15 00:07:34Z to 2025-05-15 00:07:34Z - IsHttpsDevelopmentCertificate: true - IsExportable: true
        2) 193B08B2C754BE796AFE64856FE863FD339EB078 - CN=localhost - Valid from 2024-05-15 00:07:34Z to 2025-05-15 00:07:34Z - IsHttpsDevelopmentCertificate: true - IsExportable: true
    [9] Excluded certificates: no certificates
    [14] Valid certificates: 2 certificates
        1) 193B08B2C754BE796AFE64856FE863FD339EB078 - CN=localhost - Valid from 2024-05-15 00:07:34Z to 2025-05-15 00:07:34Z - IsHttpsDevelopmentCertificate: true - IsExportable: true
        2) 193B08B2C754BE796AFE64856FE863FD339EB078 - CN=localhost - Valid from 2024-05-15 00:07:34Z to 2025-05-15 00:07:34Z - IsHttpsDevelopmentCertificate: true - IsExportable: true
    [15] Selected certificate: 193B08B2C754BE796AFE64856FE863FD339EB078 - CN=localhost - Valid from 2024-05-15 00:07:34Z to 2025-05-15 00:07:34Z - IsHttpsDevelopmentCertificate: true - IsExportable: true
    [23] Saving certificate '193B08B2C754BE796AFE64856FE863FD339EB078 - CN=localhost - Valid from 2024-05-15 00:07:34Z to 2025-05-15 00:07:34Z - IsHttpsDevelopmentCertificate: true - IsExportable: true' to openiddict.pfx with private key.
    [27] Writing the certificate to: openiddict.pfx.
    A valid HTTPS certificate is already present.
    The certificate was exported to C:\inetpub\wwwroot\PayosGate\PayosGateApi\openiddict.pfx
    PS C:\inetpub\wwwroot\PayosGate\PayosGateApi> dotnet .\PaymentManagement.hTTPAPI.HOST.DLL
    [12:44:30 INF] Starting PaymentManagement.HttpApi.Host.
    [12:44:31 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.3.0.0, Culture=neutral, PublicKeyToken=null. See the inner exception for details.
     ---> System.Security.Cryptography.CryptographicException: The specified network password is not correct.
       at System.Security.Cryptography.X509Certificates.CertificatePal.FilterPFXStore(ReadOnlySpan`1 rawData, SafePasswordHandle password, PfxCertStoreFlags pfxCertStoreFlags)
       at System.Security.Cryptography.X509Certificates.CertificatePal.FromBlobOrFile(ReadOnlySpan`1 rawData, String fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)
       at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags)
       at Microsoft.Extensions.DependencyInjection.OpenIddictServerBuilderExtensions.AddProductionEncryptionAndSigningCertificate(OpenIddictServerBuilder builder, String fileName, String passPhrase)
       at PaymentManagement.PaymentManagementApplicationContractsModule.<>c.<PreConfigureServices>b__0_2(OpenIddictServerBuilder serverBuilder) in C:\work\PayosGate\PaymentManagement\src\PaymentManagement.Application.Contracts\PaymentManagementApplicationContractsModule.cs:line 67
       at Volo.Abp.Options.PreConfigureActionList`1.Configure(TOptions options)
       at Microsoft.Extensions.DependencyInjection.ServiceCollectionPreConfigureExtensions.ExecutePreConfiguredActions[TOptions](IServiceCollection services, TOptions options)
       at Volo.Abp.OpenIddict.AbpOpenIddictAspNetCoreModule.&lt;&gt;c__DisplayClass1_0.&lt;AddOpenIddictServer&gt;b__0(OpenIddictServerBuilder builder)
       at Microsoft.Extensions.DependencyInjection.OpenIddictServerExtensions.AddServer(OpenIddictBuilder builder, Action`1 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, Action`1 optionsAction)
       at Microsoft.Extensions.DependencyInjection.ServiceCollectionApplicationExtensions.AddApplicationAsync[TStartupModule](IServiceCollection services, Action`1 optionsAction)
       at Microsoft.Extensions.DependencyInjection.WebApplicationBuilderExtensions.AddApplicationAsync[TStartupModule](WebApplicationBuilder builder, Action`1 optionsAction)
       at PaymentManagement.Program.Main(String[] args) in C:\work\PayosGate\PaymentManagement\src\PaymentManagement.HttpApi.Host\Program.cs:line 36
    PS C:\inetpub\wwwroot\PayosGate\PayosGateApi>
    
    
    
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Thanks. I will check the error logs. Please wait.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you try to remove all files from C:\inetpub\wwwroot\PayosGate\PayosGateApi and re-publish the website to IIS again?

    and regenerate the pfx by dotnet dev-certs https -v -ep openiddict.pfx -p 00000000-0000-0000-0000-000000000000

    Make sure the 00000000-0000-0000-0000-000000000000 password in the code is applied.

  • User Avatar
    0
    koraykirdinli created

    I remove the web site folder and I applied the password 00000000-0000-0000-0000-000000000000 but I got the same error.

    PS C:\inetpub\wwwroot\PayosGate\PayosGateApi> dotnet dev-certs https -v -ep openiddict.pfx -p 00000000-0000-0000-0000-000000000000 [1] Listing certificates from CurrentUser\My [2] Found certificates: 1 certificate 1) 193B08B2C754BE796AFE64856FE863FD339EB078 - CN=localhost - Valid from 2024-05-15 00:07:34Z to 2025-05-15 00:07:34Z - IsHttpsDevelopmentCertificate: true - IsExportable: true [3] Checking certificates validity [4] Valid certificates: 1 certificate 1) 193B08B2C754BE796AFE64856FE863FD339EB078 - CN=localhost - Valid from 2024-05-15 00:07:34Z to 2025-05-15 00:07:34Z - IsHttpsDevelopmentCertificate: true - IsExportable: true [5] Invalid certificates: no certificates [6] Finished listing certificates. [1] Listing certificates from LocalMachine\My [2] Found certificates: no certificates [3] Checking certificates validity [4] Valid certificates: no certificates [5] Invalid certificates: no certificates [6] Finished listing certificates. [8] Filtered certificates: 1 certificate 1) 193B08B2C754BE796AFE64856FE863FD339EB078 - CN=localhost - Valid from 2024-05-15 00:07:34Z to 2025-05-15 00:07:34Z - IsHttpsDevelopmentCertificate: true - IsExportable: true [9] Excluded certificates: no certificates [14] Valid certificates: 1 certificate 1) 193B08B2C754BE796AFE64856FE863FD339EB078 - CN=localhost - Valid from 2024-05-15 00:07:34Z to 2025-05-15 00:07:34Z - IsHttpsDevelopmentCertificate: true - IsExportable: true [15] Selected certificate: 193B08B2C754BE796AFE64856FE863FD339EB078 - CN=localhost - Valid from 2024-05-15 00:07:34Z to 2025-05-15 00:07:34Z - IsHttpsDevelopmentCertificate: true - IsExportable: true [23] Saving certificate '193B08B2C754BE796AFE64856FE863FD339EB078 - CN=localhost - Valid from 2024-05-15 00:07:34Z to 2025-05-15 00:07:34Z - IsHttpsDevelopmentCertificate: true - IsExportable: true' to openiddict.pfx with private key. [27] Writing the certificate to: openiddict.pfx. A valid HTTPS certificate is already present. The certificate was exported to C:\inetpub\wwwroot\PayosGate\PayosGateApi\openiddict.pfx PS C:\inetpub\wwwroot\PayosGate\PayosGateApi> dotnet .\PaymentManagement.hTTPAPI.HOST.DLL [13:55:57 INF] Starting PaymentManagement.HttpApi.Host. PS C:\inetpub\wwwroot\PayosGate\PayosGateApi>

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    This is weird, we keep using pfx files generated this way

    This is my pfx file, and I verified the password(00000000-0000-0000-0000-000000000000).

    You can move it to C:\inetpub\wwwroot\PayosGate\PayosGateApi

    https://we.tl/t-VCNULyhjCy

    > openssl pkcs12 -in openiddict.pfx -noout
    Enter Import Password: 00000000-0000-0000-0000-000000000000
    

    If still not working, you can use a different certificate for encryption/signing

    https://github.com/abpframework/abp/issues/13507#issuecomment-1202035746

  • User Avatar
    0
    koraykirdinli created

    We also use auth-server.pfx not openiddict.pfx. But there is some confusion. Is that can cause the issue?

    Can you connect my desktop again?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    We also use auth-server.pfx not openiddict.pfx. But there is some confusion. Is that can cause the issue?

    What do you mean by this? Please share your code or screenshots.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Please also share the code of PaymentManagementApplicationContractsModule

  • User Avatar
    0
    koraykirdinli created

    I mean my our application do not use external auth server. As you see below picture we host auth server built-in.

    I also achieve to write stdoutlogs

    EVENTLOGS Application '/LM/W3SVC/2/ROOT' with physical root 'C:\inetpub\wwwroot\PayosGate\PayosGateApiV2' has exited from Program.Main with exit code = '1'. First 30KB characters of captured stdout and stderr logs: [09:35:33 INF] Starting PaymentManagement.HttpApi.Host.

    Cannot get a local application data path. Most probably a user profile is not loaded. If LocalDB is executed under IIS, make sure that profile loading is enabled for the current user.

    Windows API call SHGetKnownFolderPath returned error code: 5. Windows system error message is: Erişim engellendi. Reported at line: 427.

    My Code is :

    public class PaymentManagementHttpApiHostModule : AbpModule
    

    { public override void PreConfigureServices(ServiceConfigurationContext context) { var hostingEnvironment = context.Services.GetHostingEnvironment(); var configuration = context.Services.GetConfiguration();

        PreConfigure&lt;OpenIddictBuilder&gt;(builder =>
        {
            builder.AddValidation(options =>
            {
                options.AddAudiences("PaymentManagement");
                options.UseLocalServer();
                options.UseAspNetCore();
            });
        });
    
        if (!hostingEnvironment.IsDevelopment())
        {
            PreConfigure&lt;AbpOpenIddictAspNetCoreOptions&gt;(options =>
            {
                options.AddDevelopmentEncryptionAndSigningCertificate = false;
            });
    
            PreConfigure&lt;OpenIddictServerBuilder&gt;(serverBuilder =>
            {
                serverBuilder.AddProductionEncryptionAndSigningCertificate("openiddict.pfx", "00000000-0000-0000-0000-000000000000");
                serverBuilder.SetIssuer(new Uri(configuration["AuthServer:Authority"]!));
            });
        }
    }
    
    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        var configuration = context.Services.GetConfiguration();
        var hostingEnvironment = context.Services.GetHostingEnvironment();
    
        if (!configuration.GetValue&lt;bool&gt;("App:DisablePII"))
        {
            Microsoft.IdentityModel.Logging.IdentityModelEventSource.ShowPII = true;
        }
    
        if (!configuration.GetValue&lt;bool&gt;("AuthServer:RequireHttpsMetadata"))
        {
            Configure&lt;OpenIddictServerAspNetCoreOptions&gt;(options =>
            {
                options.DisableTransportSecurityRequirement = true;
            });
        }
    
        ConfigureAuthentication(context);
        ConfigureUrls(configuration);
        ConfigureBundles();
        ConfigureConventionalControllers();
        ConfigureExternalProviders(context);
        ConfigureImpersonation(context, configuration);
        ConfigureHealthChecks(context);
        ConfigureSwagger(context, configuration);
        ConfigureVirtualFileSystem(context);
        ConfigureCors(context, configuration);
        ConfigureTheme();
        ConfigureHangfire(context, configuration);
    }
    
    private void ConfigureTheme()
    {
        Configure&lt;LeptonXThemeOptions&gt;(options =>
        {
            options.DefaultStyle = LeptonXStyleNames.System;
        });
    }
    
    private void ConfigureAuthentication(ServiceConfigurationContext context)
    {
        context.Services.ForwardIdentityAuthenticationForBearer(OpenIddictValidationAspNetCoreDefaults.AuthenticationScheme);
        context.Services.Configure&lt;AbpClaimsPrincipalFactoryOptions&gt;(options =>
        {
            options.IsDynamicClaimsEnabled = true;
        });
    }
    
    private void ConfigureUrls(IConfiguration configuration)
    {
        Configure&lt;AppUrlOptions&gt;(options =>
        {
            options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"];
            options.Applications["Angular"].RootUrl = configuration["App:AngularUrl"];
            options.Applications["Angular"].Urls[AccountUrlNames.PasswordReset] = "account/reset-password";
            options.Applications["Angular"].Urls[AccountUrlNames.EmailConfirmation] = "account/email-confirmation";
            options.RedirectAllowedUrls.AddRange(configuration["App:RedirectAllowedUrls"]?.Split(',') ?? Array.Empty&lt;string&gt;());
        });
    }
    
    private void ConfigureBundles()
    {
        Configure&lt;AbpBundlingOptions&gt;(options =>
        {
            options.StyleBundles.Configure(
                LeptonXThemeBundles.Styles.Global,
                bundle =>
                {
                    bundle.AddFiles("/global-styles.css");
                }
            );
        });
    }
    
    
    private void ConfigureVirtualFileSystem(ServiceConfigurationContext context)
    {
        var hostingEnvironment = context.Services.GetHostingEnvironment();
    
        if (hostingEnvironment.IsDevelopment())
        {
            Configure&lt;AbpVirtualFileSystemOptions&gt;(options =>
            {
                options.FileSets.ReplaceEmbeddedByPhysical&lt;PaymentManagementDomainSharedModule&gt;(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}PaymentManagement.Domain.Shared"));
                options.FileSets.ReplaceEmbeddedByPhysical&lt;PaymentManagementDomainModule&gt;(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}PaymentManagement.Domain"));
                options.FileSets.ReplaceEmbeddedByPhysical&lt;PaymentManagementApplicationContractsModule&gt;(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}PaymentManagement.Application.Contracts"));
                options.FileSets.ReplaceEmbeddedByPhysical&lt;PaymentManagementApplicationModule&gt;(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}PaymentManagement.Application"));
            });
        }
    }
    
    private void ConfigureConventionalControllers()
    {
        Configure&lt;AbpAspNetCoreMvcOptions&gt;(options =>
        {
            options.ConventionalControllers.Create(typeof(PaymentManagementApplicationModule).Assembly);
        });
    }
    
    private static void ConfigureSwagger(ServiceConfigurationContext context, IConfiguration configuration)
    {
        context.Services.AddAbpSwaggerGenWithOidc(
            configuration["AuthServer:Authority"]!,
            ["PaymentManagement"],
            [AbpSwaggerOidcFlows.AuthorizationCode],
            null,
            options =>
            {
                options.SwaggerDoc("v1", new OpenApiInfo { Title = "PaymentManagement API", Version = "v1" });
                options.DocInclusionPredicate((docName, description) => true);
                options.CustomSchemaIds(type => type.FullName);
                options.HideAbpEndpoints();
            });
    }
    
    private void ConfigureCors(ServiceConfigurationContext context, IConfiguration configuration)
    {
        context.Services.AddCors(options =>
        {
            options.AddDefaultPolicy(builder =>
            {
                builder
                    .WithOrigins(
                        configuration["App:CorsOrigins"]?
                            .Split(",", StringSplitOptions.RemoveEmptyEntries)
                            .Select(o => o.Trim().RemovePostFix("/"))
                            .ToArray() ?? Array.Empty&lt;string&gt;()
                    )
                    .WithAbpExposedHeaders()
                    .SetIsOriginAllowedToAllowWildcardSubdomains()
                    .AllowAnyHeader()
                    .AllowAnyMethod()
                    .AllowCredentials();
            });
        });
    }
    
    private void ConfigureExternalProviders(ServiceConfigurationContext context)
    {
        context.Services.AddAuthentication()
            .AddGoogle(GoogleDefaults.AuthenticationScheme, options =>
            {
                options.ClaimActions.MapJsonKey(AbpClaimTypes.Picture, "picture");
            })
            .WithDynamicOptions&lt;GoogleOptions, GoogleHandler&gt;(
                GoogleDefaults.AuthenticationScheme,
                options =>
                {
                    options.WithProperty(x => x.ClientId);
                    options.WithProperty(x => x.ClientSecret, isSecret: true);
                }
            )
            .AddMicrosoftAccount(MicrosoftAccountDefaults.AuthenticationScheme, options =>
            {
                //Personal Microsoft accounts as an example.
                options.AuthorizationEndpoint = "https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize";
                options.TokenEndpoint = "https://login.microsoftonline.com/consumers/oauth2/v2.0/token";
    
                options.ClaimActions.MapCustomJson("picture", _ => "https://graph.microsoft.com/v1.0/me/photo/$value");
                options.SaveTokens = true;
            })
            .WithDynamicOptions&lt;MicrosoftAccountOptions, MicrosoftAccountHandler&gt;(
                MicrosoftAccountDefaults.AuthenticationScheme,
                options =>
                {
                    options.WithProperty(x => x.ClientId);
                    options.WithProperty(x => x.ClientSecret, isSecret: true);
                }
            )
            .AddTwitter(TwitterDefaults.AuthenticationScheme, options =>
            {
                options.ClaimActions.MapJsonKey(AbpClaimTypes.Picture, "profile_image_url_https");
                options.RetrieveUserDetails = true;
            })
            .WithDynamicOptions&lt;TwitterOptions, TwitterHandler&gt;(
                TwitterDefaults.AuthenticationScheme,
                options =>
                {
                    options.WithProperty(x => x.ConsumerKey);
                    options.WithProperty(x => x.ConsumerSecret, isSecret: true);
                }
            );
    }
    
    private void ConfigureImpersonation(ServiceConfigurationContext context, IConfiguration configuration)
    {
        context.Services.Configure&lt;AbpAccountOptions&gt;(options =>
        {
            options.TenantAdminUserName = "admin";
            options.ImpersonationTenantPermission = SaasHostPermissions.Tenants.Impersonation;
            options.ImpersonationUserPermission = IdentityPermissions.Users.Impersonation;
        });
    }
    
    private void ConfigureHealthChecks(ServiceConfigurationContext context)
    {
        context.Services.AddPaymentManagementHealthChecks();
    }
    
    private void ConfigureHangfire(ServiceConfigurationContext context, IConfiguration configuration)
    {
        context.Services.AddHangfire(config =>
        {
            config.UseSqlServerStorage(configuration.GetConnectionString("Default"));
        });
        //context.Services.AddHangfireServer();
    }
    
    public override void OnApplicationInitialization(ApplicationInitializationContext context)
    {
        var app = context.GetApplicationBuilder();
        var env = context.GetEnvironment();
    
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }
    
        app.UseAbpRequestLocalization();
    
        if (!env.IsDevelopment())
        {
            app.UseErrorPage();
        }
        
        app.UseStaticFiles();
        app.UseAbpStudioLink();
        app.UseRouting();
        app.UseAbpSecurityHeaders();
        app.UseCors();
        app.UseAuthentication();
        app.UseAbpOpenIddictValidation();
    
        if (MultiTenancyConsts.IsEnabled)
        {
            app.UseMultiTenancy();
        }
    
        app.UseUnitOfWork();
        app.UseDynamicClaims();
        app.UseAuthorization();
    
        app.UseSwagger();
        app.UseAbpSwaggerUI(options =>
        {
            options.SwaggerEndpoint("/swagger/v1/swagger.json", "PaymentManagement API");
    
            var configuration = context.ServiceProvider.GetRequiredService&lt;IConfiguration&gt;();
            options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]);
            options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]);
        });
        app.UseAuditing();
        app.UseAbpSerilogEnrichers();
        app.UseAbpHangfireDashboard();
        app.UseConfiguredEndpoints();
    }
    

    }

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please also share the code of PaymentManagementApplicationContractsModule

    the exception is cause by C:\work\PayosGate\PaymentManagement\src\PaymentManagement.Application.Contracts\PaymentManagementApplicationContractsModule.cs:line 67

     ---> System.Security.Cryptography.CryptographicException: The specified network password is not correct.
       at System.Security.Cryptography.X509Certificates.CertificatePal.FilterPFXStore(ReadOnlySpan`1 rawData, SafePasswordHandle password, PfxCertStoreFlags pfxCertStoreFlags)
       at System.Security.Cryptography.X509Certificates.CertificatePal.FromBlobOrFile(ReadOnlySpan`1 rawData, String fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)
       at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags)
       at Microsoft.Extensions.DependencyInjection.OpenIddictServerBuilderExtensions.AddProductionEncryptionAndSigningCertificate(OpenIddictServerBuilder builder, String fileName, String passPhrase)
       at PaymentManagement.PaymentManagementApplicationContractsModule.<>c.<PreConfigureServices>b__0_2(OpenIddictServerBuilder serverBuilder) in C:\work\PayosGate\PaymentManagement\src\PaymentManagement.Application.Contracts\PaymentManagementApplicationContractsModule.cs:line 67
    
  • User Avatar
    0
    koraykirdinli created

    public override void PreConfigureServices(ServiceConfigurationContext context) { //PaymentManagementDtoExtensions.Configure();

     var hostingEnvironment = context.Services.GetHostingEnvironment();
     var configuration = context.Services.GetConfiguration();
    
     PreConfigure&lt;OpenIddictBuilder&gt;(builder =>
     {
         builder.AddValidation(options =>
         {
             options.AddAudiences("PaymentManagement");
             options.UseLocalServer();
             options.UseAspNetCore();
         });
     });
    
     if (!hostingEnvironment.IsDevelopment())
     {
         PreConfigure&lt;AbpOpenIddictAspNetCoreOptions&gt;(options =>
         {
             options.AddDevelopmentEncryptionAndSigningCertificate = true;
         });
    
         PreConfigure&lt;OpenIddictServerBuilder&gt;(serverBuilder =>
         {
             //serverBuilder.AddProductionEncryptionAndSigningCertificate("openiddict.pfx", "00000000 - 0000 - 0000 - 0000 - 000000000000");
             serverBuilder.AddProductionEncryptionAndSigningCertificate("openiddict.pfx", "00000000-0000-0000-0000-000000000000");
         });
     }
    

    }

  • User Avatar
    0
    koraykirdinli created

    By the way

    options.AddDevelopmentEncryptionAndSigningCertificate = true;

    I also just try true, but i was false

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