Starts in:
2 DAYS
2 HRS
38 MIN
30 SEC
Starts in:
2 D
2 H
38 M
30 S
Open Closed

backend deployment error in IIS #6258


User avatar
0
ed_developer3 created

Production ABP Framework version: v7.4.0 UI Type: Angular Database System: EF Core (SQL Server) .net 7 is .framework.IIS 1 on windows server 2019 Data center

We tried to use background job in api.host project but ended up in volo.abp.core 8.0.0 error while configuring the services in api.host project. here is the error stack trace

HTTP Error 500.30 - ASP.NET Core app failed to start

System.IO.FileNotFoundException: Could not load file or assembly 'Volo.Abp.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File name: 'Volo.Abp.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null'
at System.Reflection.CustomAttribute.\_CreateCaObject(RuntimeModule pModule, RuntimeType type, IRuntimeMethodInfo pCtor, Byte\*\* ppBlob, Byte\* pEndBlob, Int32\* pcNamedArgs)
at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder`1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1 derivedAttributes)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at System.Attribute.GetCustomAttributes(MemberInfo element, Boolean inherit)
at Volo.Abp.Modularity.AbpModuleHelper.FindDependedModuleTypes(Type moduleType)
at Volo.Abp.Modularity.AbpModuleHelper.AddModuleAndDependenciesRecursively(List`1 moduleTypes, Type moduleType, ILogger logger, Int32 depth) at Volo.Abp.Modularity.AbpModuleHelper.AddModuleAndDependenciesRecursively(List`1 moduleTypes, Type moduleType, ILogger logger, Int32 depth)
at Volo.Abp.Modularity.AbpModuleHelper.AddModuleAndDependenciesRecursively(List`1 moduleTypes, Type moduleType, ILogger logger, Int32 depth) at Volo.Abp.Modularity.AbpModuleHelper.AddModuleAndDependenciesRecursively(List`1 moduleTypes, Type moduleType, ILogger logger, Int32 depth)
at Volo.Abp.Modularity.AbpModuleHelper.AddModuleAndDependenciesRecursively(List`1 moduleTypes, Type moduleType, ILogger logger, Int32 depth) at Volo.Abp.Modularity.AbpModuleHelper.AddModuleAndDependenciesRecursively(List`1 moduleTypes, Type moduleType, ILogger logger, Int32 depth)
at Volo.Abp.Modularity.AbpModuleHelper.FindAllModuleTypes(Type startupModuleType, ILogger logger)
at Volo.Abp.Modularity.ModuleLoader.FillModules(List`1 modules, IServiceCollection services, Type startupModuleType, PlugInSourceList plugInSources) at Volo.Abp.Modularity.ModuleLoader.GetDescriptors(IServiceCollection services, Type startupModuleType, PlugInSourceList plugInSources) at Volo.Abp.Modularity.ModuleLoader.LoadModules(IServiceCollection services, Type startupModuleType, PlugInSourceList plugInSources) at Volo.Abp.AbpApplicationBase.LoadModules(IServiceCollection services, AbpApplicationCreationOptions options) at Volo.Abp.AbpApplicationBase..ctor(Type startupModuleType, IServiceCollection services, Action`1 optionsAction)
at Volo.Abp.AbpApplicationWithExternalServiceProvider..ctor(Type startupModuleType, IServiceCollection services, Action`1 optionsAction) at Volo.Abp.AbpApplicationFactory.Create(Type startupModuleType, IServiceCollection services, Action`1 optionsAction)
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 Wbi.Program.Main(String[] args) in /home/BUILD/wbidevapi.essentialdemo.com/wbibackend/src/Wbi.HttpApi.Host/Program.cs:line 41

Also we tried to mimic same error on local IIS (window 10 pro) but it was also giving same error code. but different error stack HTTP Error 500.30 - ASP.NET Core app failed to start

2023-11-29 14:01:28.508 +05:30 [FTL] Host terminated unexpectedly!
Volo.Abp.AbpInitializationException: An error occurred during ConfigureServicesAsync phase of the module Wbi.WbiHttpApiHostModule, Wbi.HttpApi.Host, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. See the inner exception for details.
\-\-\-\> System\.NullReferenceException: Object reference not set to an instance of an object\.
at Microsoft.Extensions.DependencyInjection.AbpSwaggerGenServiceCollectionExtensions.AddAbpSwaggerGenWithOAuth(IServiceCollection services, String authority, Dictionary`2 scopes, Action`1 setupAction, String authorizationEndpoint, String tokenEndpoint)
at Wbi.WbiHttpApiHostModule.ConfigureSwagger(ServiceConfigurationContext context, IConfiguration configuration) in D:\Work\orionProjects\WBI\code\aspnet-core\src\Wbi.HttpApi.Host\WbiHttpApiHostModule.cs:line 292
at Wbi.WbiHttpApiHostModule.ConfigureServices(ServiceConfigurationContext context) in D:\Work\orionProjects\WBI\code\aspnet-core\src\Wbi.HttpApi.Host\WbiHttpApiHostModule.cs:line 212
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 Wbi.Program.Main(String[] args) in D:\Work\orionProjects\WBI\code\aspnet-core\src\Wbi.HttpApi.Host\Program.cs:line 41

we commented configure swagger it resulted in this error

2023-11-29 15:51:50.255 +05:30 [INF] Starting Wbi.HttpApi.Host.
2023-11-29 15:51:52.010 +05:30 [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=7.4.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(Byte[] rawData, String password, X509KeyStorageFlags keyStorageFlags)
at Microsoft.Extensions.DependencyInjection.OpenIddictServerBuilder.AddDevelopmentEncryptionCertificate(X500DistinguishedName subject)
at Microsoft.Extensions.DependencyInjection.OpenIddictServerBuilder.AddDevelopmentEncryptionCertificate()
at Volo.Abp.OpenIddict.AbpOpenIddictAspNetCoreModule.<>c\_\_DisplayClass1\_0.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 Wbi.Program.Main(String[] args)


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

    hi

    First error: What's your lepton package version? You need to make sure all packages are the same.

    Second error: It may miss some configurations in appsettions.json

    Third error

    AddDevelopmentEncryptionAndSigningCertificate cannot be used in applications deployed on IIS or Azure App Service: trying to use them on IIS or Azure App Service will result in an exception being thrown at runtime (unless the application pool is configured to load a user profile). To avoid that, consider creating self-signed certificates and storing them in the X.509 certificates store of the host machine(s). Please refer to: https://documentation.openiddict.com/configuration/encryption-and-signing-credentials.html#registering-a-development-certificate

    https://docs.abp.io/en/abp/8.0/Deployment/Configuring-OpenIddict

  • User Avatar
    0
    ed_developer3 created

    Hi We are using leptonx theme 7.4.0 how come its throwing error for the package we have not used and abp has not released yet. how come Volo.abp.core -version 8.0.0.0 comes into play which code is using or has dependency on it. can you share more details on it.

    When you say "Also packages are same" , how to check if its are same if no build error is there and we are able to run it in Visual studio. Problem is when we are using the published code into IIS on windows server 2019 data center.

    Just to add on is it due to that we checked in code from a machine which was having .net 8.0 framework installed. does this error something to do with .net farmework 8.0.

    Thanks

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    What are the error now?

    First, second or third?

  • User Avatar
    0
    ed_developer3 created

    its First on production

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share some code to reproduce the first error?

  • User Avatar
    0
    ed_developer3 created

    you can uncomment the commented code for background jobs to reproduce.

    using System; using System.Collections.Generic; using System.IO; using System.Linq; using Microsoft.AspNetCore.Authentication.Google; using Microsoft.AspNetCore.Authentication.MicrosoftAccount; using Microsoft.AspNetCore.Authentication.Twitter; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Cors; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.AspNetCore.Extensions.DependencyInjection; using OpenIddict.Validation.AspNetCore; using OpenIddict.Server.AspNetCore; using Wbi.EntityFrameworkCore; using Wbi.MultiTenancy; using Microsoft.OpenApi.Models; using Volo.Abp; using Volo.Abp.Account.Web; using Volo.Abp.Account.Public.Web; using Volo.Abp.Account.Public.Web.Impersonation; using Volo.Abp.AspNetCore.MultiTenancy; using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.Autofac; using Volo.Abp.Localization; using Volo.Abp.Modularity; using Volo.Abp.UI.Navigation.Urls; using Volo.Abp.VirtualFileSystem; using Volo.Abp.Account; using Volo.Abp.Account.Public.Web.ExternalProviders; using Volo.Abp.AspNetCore.Mvc.UI.Bundling; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; using Microsoft.AspNetCore.Hosting; using Wbi.HealthChecks; using Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX; using Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX.Bundling; using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.Identity; using Volo.Abp.LeptonX.Shared; using Volo.Abp.Swashbuckle; using Volo.Saas.Host; using Volo.Abp.OpenIddict; using Microsoft.IdentityModel.Tokens; using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Http; using Volo.Abp.BlobStoring; using Volo.Abp.BlobStoring.FileSystem; using Serilog; using Volo.Abp.Auditing; using Volo.Abp.BlobStoring.Database; using Volo.FileManagement; using ProjectModule; using Volo.Abp.BackgroundJobs; using Microsoft.EntityFrameworkCore; using MasterModule.LookUps; using MasterModule.Provinces; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.BackgroundWorkers; using Wbi.Services.BackGroundJobs;

    namespace Wbi;

    [DependsOn( typeof(WbiHttpApiModule), typeof(AbpAutofacModule), typeof(AbpAspNetCoreMultiTenancyModule), typeof(WbiApplicationModule), typeof(WbiEntityFrameworkCoreModule), typeof(AbpAspNetCoreMvcUiLeptonXThemeModule), typeof(AbpAccountPublicWebImpersonationModule), typeof(AbpAccountPublicWebOpenIddictModule), typeof(AbpSwashbuckleModule), typeof(AbpAspNetCoreSerilogModule), typeof(AbpBlobStoringFileSystemModule) )] public class WbiHttpApiHostModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) {

    #if RELEASE //test commit. //these are new changes made to deploy this app to IIS, to get rid of development certificates. PreConfigure<AbpOpenIddictAspNetCoreOptions>(options => { options.AddDevelopmentEncryptionAndSigningCertificate = false; });

        //if we need to run this app on azure or load balancer, the signing keys wil not work, we may have to use x509 certificate
        PreConfigure&lt;OpenIddictServerBuilder&gt;(builder =>
        {
            // builder.AddEncryptionKey(new SymmetricSecurityKey
            //        (Convert.FromBase64String("DRjd/GnduI3Efzen9V9BvbNUfc/VKgXltV7Kbk9sMkY=")));
            //Set options here...		
            builder.AddEphemeralEncryptionKey()
              .AddEphemeralSigningKey();
        });
    

    #endif
    PreConfigure<OpenIddictBuilder>(builder => { builder.AddValidation(options => {

                options.AddAudiences("Wbi");
                options.UseLocalServer();
                options.UseAspNetCore();
            });
        });
    
        PreConfigure&lt;OpenIddictServerBuilder&gt;(builder =>
        {
            builder
                .SetAccessTokenLifetime(TimeSpan.FromHours(1))
                .SetIdentityTokenLifetime(TimeSpan.FromHours(1));
        });
    }
    
    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        var configuration = context.Services.GetConfiguration();
        var hostingEnvironment = context.Services.GetHostingEnvironment();
    
        Configure&lt;AbpBlobStoringOptions&gt;(options =>
        {
            options.Containers.Configure&lt;DocumentContainer&gt;(container =>
            {
                container.UseFileSystem(fileSystem =>
                {
                    fileSystem.BasePath = configuration["DocumentPaths:UploadDocuments"];
                    //fileSystem.BasePath = "C:\\Blobdocs";
                });
            });
        });
    
        //Configure&lt;AbpBackgroundJobWorkerOptions&gt;(options =>
        //{
        //    options.DefaultTimeout = 864000; //10 days (as seconds)
        //});
        Configure&lt;AbpBackgroundJobOptions&gt;(options =>
        {
            options.IsJobExecutionEnabled = true; //Disables job execution
        });
    
    
        //Configure&lt;AbpBlobStoringOptions&gt;(options =>
        //    {
        //        options.Containers.Configure("account-profile-pictures", container =>
        //        {
        //            container.UseFileSystem(fileSystem =>
        //                    {
        //                        fileSystem.BasePath = configuration["DocumentPaths:UploadDocuments"];
        //                        //fileSystem.BasePath = "C:\\Blobdocs";
        //                    });
        //        });
        //    });
    
        //Configure&lt;AbpBlobStoringOptions&gt;(options =>
        //{
        //    options.Containers.Configure("documents", container =>
        //    {
        //        container.UseFileSystem(fileSystem =>
        //                {
        //                    fileSystem.BasePath = configuration["DocumentPaths:UploadDocuments"];
        //                    //fileSystem.BasePath = "C:\\Blobdocs";
        //                });
        //    });
        //});
    
        context.Services.ConfigureApplicationCookie(options =>
        {
            options.ExpireTimeSpan = TimeSpan.FromHours(1); // Set the expiration time to 5 minutes
            options.SlidingExpiration = false;
        });
    
        Configure&lt;AbpAuditingOptions&gt;(options =>
        {
            options.EntityHistorySelectors.AddAllEntities();
        });
        if (!Convert.ToBoolean(configuration["App:DisablePII"]))
        {
            Microsoft.IdentityModel.Logging.IdentityModelEventSource.ShowPII = true;
        }
    
        if (!Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]))
        {
            Configure&lt;OpenIddictServerAspNetCoreOptions&gt;(options =>
            {
                options.DisableTransportSecurityRequirement = true;
            });
        }
    
        if (!Convert.ToBoolean(configuration["App:DisablePII"]))
        {
            Microsoft.IdentityModel.Logging.IdentityModelEventSource.ShowPII = true;
        }
    
        if (!Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]))
        {
            Configure&lt;OpenIddictServerAspNetCoreOptions&gt;(options =>
            {
                options.DisableTransportSecurityRequirement = true;
            });
        }
    
        ConfigureAuthentication(context);
        ConfigureUrls(configuration);
        ConfigureBundles();
        ConfigureConventionalControllers();
        ConfigureImpersonation(context, configuration);
        ConfigureSwagger(context, configuration);
        ConfigureVirtualFileSystem(context);
        ConfigureCors(context, configuration);
        ConfigureExternalProviders(context);
        ConfigureHealthChecks(context);
        ConfigureTheme();
    
    }
    
    private void ConfigureTheme()
    {
        Configure&lt;LeptonXThemeOptions&gt;(options =>
        {
            options.DefaultStyle = LeptonXStyleNames.System;
        });
    }
    
    private void ConfigureAuthentication(ServiceConfigurationContext context)
    {
        context.Services.ForwardIdentityAuthenticationForBearer(OpenIddictValidationAspNetCoreDefaults.AuthenticationScheme);
    }
    
    private void ConfigureHealthChecks(ServiceConfigurationContext context)
    {
        context.Services.AddWbiHealthChecks();
    }
    
    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(','));
        });
    }
    
    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;WbiDomainSharedModule&gt;(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Wbi.Domain.Shared"));
                options.FileSets.ReplaceEmbeddedByPhysical&lt;WbiDomainModule&gt;(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Wbi.Domain"));
                options.FileSets.ReplaceEmbeddedByPhysical&lt;WbiApplicationContractsModule&gt;(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Wbi.Application.Contracts"));
                options.FileSets.ReplaceEmbeddedByPhysical&lt;WbiApplicationModule&gt;(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Wbi.Application"));
            });
        }
    }
    
    private void ConfigureConventionalControllers()
    {
        Configure&lt;AbpAspNetCoreMvcOptions&gt;(options =>
        {
            options.ConventionalControllers.Create(typeof(WbiApplicationModule).Assembly);
        });
    }
    
    private static void ConfigureSwagger(ServiceConfigurationContext context, IConfiguration configuration)
    {
        context.Services.AddAbpSwaggerGenWithOAuth(
            configuration["AuthServer:Authority"],
            new Dictionary&lt;string, string&gt;
            {
                    {"Wbi", "Wbi API"}
            },
            options =>
            {
                options.SwaggerDoc("v1", new OpenApiInfo { Title = "Wbi API", Version = "v1" });
                options.DocInclusionPredicate((docName, description) => true);
                options.CustomSchemaIds(type => type.FullName);
            });
    }
    
    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()
                    )
                    .WithAbpExposedHeaders()
                    .SetIsOriginAllowedToAllowWildcardSubdomains()
                    .AllowAnyHeader()
                    .AllowAnyMethod()
                    .AllowCredentials();
            });
        });
    }
    
    private void ConfigureExternalProviders(ServiceConfigurationContext context)
    {
        context.Services.AddAuthentication()
            .AddGoogle(GoogleDefaults.AuthenticationScheme, _ => { })
            .WithDynamicOptions&lt;GoogleOptions, GoogleHandler&gt;(
                GoogleDefaults.AuthenticationScheme,
                options =>
                {
                    options.WithProperty(x => x.ClientId);
                    options.WithProperty(x => x.ClientSecret, isSecret: true);
                }
            ).AddCookie(options =>
            {
                // add an instance of the patched manager to the options:
                options.CookieManager = new ChunkingCookieManager();
                options.Cookie.HttpOnly = true;
                options.Cookie.SameSite = SameSiteMode.None;
                options.Cookie.SecurePolicy = CookieSecurePolicy.Always;
            })
            .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";
            })
            .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.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;
        });
    }
    
    public override void OnApplicationInitialization(ApplicationInitializationContext context)
    {
        var app = context.GetApplicationBuilder();
        var env = context.GetEnvironment();
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }
        //below cofigures auto trigger to background job
        //context.ServiceProvider
        //.GetRequiredService&lt;IBackgroundWorkerManager&gt;()
        //.AddAsync(
        // context
        //     .ServiceProvider
        //     .GetRequiredService&lt;SecurityRequirement_Job&gt;()
        //);
        // end of job
        app.UseAbpRequestLocalization();
    
        if (!env.IsDevelopment())
        {
            app.UseErrorPage();
        }
    
        app.UseAbpSecurityHeaders();
        app.UseStaticFiles();
        app.UseRouting();
        app.UseCors();
        app.UseAuthentication();
        app.UseAbpOpenIddictValidation();
    
        if (MultiTenancyConsts.IsEnabled)
        {
            app.UseMultiTenancy();
        }
    
        app.UseUnitOfWork();
    
        app.UseAuthorization();
        app.UseSwagger();
        app.UseAbpSwaggerUI(options =>
        {
            options.SwaggerEndpoint("/swagger/v1/swagger.json", "Wbi API");
    
            var configuration = context.ServiceProvider.GetRequiredService&lt;IConfiguration&gt;();
            options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]);
        });
        app.UseAuditing();
        app.UseAbpSerilogEnrichers();
        app.UseConfiguredEndpoints();
    }
    

    }

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I think I can't reproduce the error based on your code. Can you share a project?

  • User Avatar
    0
    ed_developer3 created

    Error is gone as of now, we used last code copy which was deployed on UAT and modified APi.HostModule in API host project. but not sure what went wrong and how error is gone.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Good news.

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