Base solution for your next web application

Activities of "Ricavir"

ASP.NET CORE + Angular

Hi,

I have activated HangFire. I'm able to access to the Hangfire dashboard after login in from MVC page (from http://localhost:22742/ui/login) Everything works well without identityserver. But when I activate identityserver, I'm having an issue on UiController : when redirected to Index action, GetCurrentLoginInformationsAsync returns a null User. Therefore, I'm redirected to Login page...

Here is the code :

 [DisableAuditing]
    public async Task<IActionResult> Index()
    {
        var model = new HomePageModel
        {
            LoginInformation = await _sessionCache.GetCurrentLoginInformationsAsync(),
            IsMultiTenancyEnabled = _multiTenancyConfig.IsEnabled
        };
    
        if (model.LoginInformation?.User == null)
        {
            return RedirectToAction("Login");
        }
    
        return View(model);
    }

When identityserver is deactivated, the User information is not null...

I have configured IdentityServer the same as Zero.

Can you please provide some help ?

Sorry @Ismcagdas, I just saw that Hangfire is able to manage background jobs on multiple instances. I will try it and come back to you if I need some additional help. This ticket can be closed.

Hi @Ismcagdas, thank you for your feedback.

Can you provide an SQL command to do this stuff ? Or something similar ?

Hi @Ismcagdas,

It has been a while since the last time :)

In fact, WEBSITE_INSTANCE_ID is an environment variable available on Azure App Service VM's. So, yes, I can read it.

My problem is that I want to store it somewhere outside the VM, this is why I need your help. I was thinking to store it in cache (I'm using Redis) or in Azure blob storage.

What is your advise about this ? Can I access cache or azure storage before setting Configuration.BackgroundJobs.IsJobExecutionEnabled ?

My goal is to activate background job execution only in the first instance ; the one that will start the app. Therefore, if a new instance is pushed in by Azure (automatic scale), the background job execution will not be started twice.

Hi,

I need to activate two factor auth for one of my tenants. From my tests, if I activate two factor on host side then all tenants are also activated. How can I proceed to activate only one tenant ?

Do I need to run a database command to add a tenant setting to all tenants in order to deactivate two factor auth ?

Cheers

Hi,

I would like to configure my app according to the current instance count. The goal is to activate background jobs on the first instance of the app ; and to avoid to activate it for the next instances.

I'm using Azure App Service and starting the app with 1 instance. The app can switch to 2/3or 4 instances according to the CPU/RAM load.

I will use the environment variable WEBSITE_INSTANCE_ID to manage this : this value gives a unique instance ID.

My idea is to store this value (in cache or somewhere else). When app starts, I need to read this value in the PostInitialize method of WebHostModule class. If the value exists, I don't activate the background jobs for the instance. If no value set, then I start the backgound jobs for current instance (which should be the first).

Can you please help me to achieve this ? Specialy for the read/write data in the postinitialize method ?

This could help a lot of people that is struggling out with multiple instances on ABP.

Thks

I confirm that the issue was coming from Azure SQL database DTU count. I upgraded DTU to a significant amount (from 20 to 200 DTU's). This allowed to run the migrations correctly wihtout timeout. Then, back to original DTU count (20) and everything is working fine.

I close this issue

Hum, I think that the fact of reaching maximum DTU during the migration is causing an abort of the process. I will try to switch to a premium tier with higher DTU count tonight. I will give you a feedback afterwords

Hi @ismcagdas,

Thank you for your fast answer. I don't think it is a firewall issue as I'm still able to connect with SSMS. Just checked right now without any issue. The latest successful migration has been done 20 days ago with the same machine and same IP address. The migrations that are pending are really simple : just addind few properties to existing tables.

Is it possible that the migration process consumes too much resource to such a point that process cannot ends before a timeout ? Could this be linked with a large amount of data in a table ?

Abp 6.6.2 Angular .NET 5

Hi,

I'm getting a timeout exception when trying to migrate our Azure prod database. We never had this exception before for more than 100 migrations in the past years. This exception is only happening on production. We notice a DB consumption spike on azure every time we run the migrator : therefore, we upgraded our plan from 20DTU to 50DTU. Still same error. We have tried to add a connection timeout of 900s in the connection string but it also fails.

Changing the connection string to local DB works correctly.

Here is the exception :

2022-05-31 07:40:18 | Host database: Server=tcp:xxx.database.windows.net,1433;Initial Catalog=xxxx;User ID=xxxx;Password=xxxx;
2022-05-31 07:40:25 | Continue to migration for this host database and all tenants..? (Y/N):
Y
2022-05-31 07:40:37 | HOST database migration started...
2022-05-31 07:41:37 | An error occured during migration of host database:
2022-05-31 07:41:37 | Microsoft.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
 ---> System.ComponentModel.Win32Exception (258): Dépassement du délai d'attente.
   at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean isAsync, Int32 timeout, Boolean asyncWrite)
   at Microsoft.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String methodName)
   at Microsoft.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
   at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
   at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate(DatabaseFacade databaseFacade)
   at Abp.Zero.EntityFrameworkCore.AbpZeroDbMigrator`1.CreateOrMigrate(AbpTenantBase tenant, Action`1 seedAction)
   at Abp.Zero.EntityFrameworkCore.AbpZeroDbMigrator`1.CreateOrMigrateForHost(Action`1 seedAction)
   at App.Migrator.MultiTenantMigrateExecuter.Run(Boolean skipConnVerification) in C:\Users\User\source\repos\App_AspnetZero\aspnet-core\src\App.Migrator\MultiTenantMigrateExecuter.cs:line 62
ClientConnectionId:f8435bcc-7872-4566-aac5-57cf9941e750
Error Number:-2,State:0,Class:11
2022-05-31 07:41:37 | Canceled migrations.
Press ENTER to exit...

Our production code is currently blocked because of this exception. Any help would be much apreciated :)

Showing 11 to 20 of 314 entries