Base solution for your next web application

Activities of "Ricavir"

Hi team !

I have an existing tenant that has been created in host database. I would like to switch him from host database to a new dedicated database. The new database connection string will be set in tenant settings. Do you have some guidelines to migrate its existing data to the new database ?

Question

Hi,

I need to activate Azure CDN for my app that is running over Azure App Service. I'm using Angular v15 and .NET7. Thus, I need to update appsettings file and appconfig file. I followed this article : https://docs.aspnetzero.com/en/aspnet-core-angular/latest/Step-by-step-publish-to-azure-angular-staticsite but it does not mentioned tenant resolution...

My current appsettings file is :

"App": {
    "ServerRootAddress": "https://{TENANCY_NAME}.xxxx-app.com/",
    "ClientRootAddress": "https://{TENANCY_NAME}.xxxx-app.com/",
    "CorsOrigins": "https://*.xxxx-app.com,http://*.xxxx-app.com",
  },

My current angular appconfig file is :

{
  "remoteServiceBaseUrl": "https://{TENANCY_NAME}.xxxx-app.com",
  "appBaseUrl": "https://{TENANCY_NAME}.xxxx-app.com"
}

Let's say that CDN endpoint is : http://xxxx-app.azureedge.net

Can you please provide some advice to update app URL's with tenant resolution {TENANCY_NAME} ?

Angular (single solution) .NET 5 Abp 6.6.2

Hi,

I recently upgraded my app to activate hangfire and twofactor auth (also added MVC controllers to be able to log in and have access to hangfire dashboard) While everything was working well on development server, I realize in production that impersonation and switching to a linked account was not working anymore.

Host and Angular are in the same server and within the same domain

Currently, when I try impersonation, I'm automatically logged out. Same behavior if I try to switch to another account.

I'm seeing a redirection to index.html before being logged out... and this was not happening previously.

I've tried several things (like deactivating hangfire) but I still have the same behavior.

Can you please help me fixing this ? I'm not very confortable with that parts of the app :/

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 ?

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

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 :)

  • Abp 6.4
  • Angular
  • .NET 5

Hi support team,

I'm currently focusing on EF queries optimization, specially for read only queries. I realized that EF queries like this one :

await _entityRepository.getAll().Include(e => e.NestedEntity).OrderBy(input.Sorting).PageBy(input).ToListAsync()

is causing database delays because SQL engine tries to get every properties from entity (event more if a nested entity is included in the query).

After some tests, I achieve a query 4x times faster by selecting only needed entity properties like that :

await _entityRepository.getAll().Include(e => e.NestedEntity).Select(e => new EntityDto { Id = e.Id, Description = e.Description}).OrderBy(input.Sorting).PageBy(input).ToListAsync()

As you can see, I'm using a DTO (EntityDto) to map from Entity object (this is called "projection"). My goal is to reuse all existing DTO's to optimize all select queries ; BUT I'm doing the mapping manually, which can cause errors in the future (ex : if a new property is added to the DTO). I need this to be more maintainable and optimized.

Do you have a solution to automatically map the DTO in the SELECT statement of the query ?

  • Abp 6.2.2
  • Angular
  • .NET5

Hi abp team,

I'm getting following error several times per day :

ERROR 2022-02-11 10:24:53,841 [86   ] me.Caching.Redis.AbpPerRequestRedisCache - System.ObjectDisposedException: IFeatureCollection has been disposed.
Object name: 'Collection'.
   at Microsoft.AspNetCore.Http.Features.FeatureReferences`1.ThrowContextDisposed()
   at Microsoft.AspNetCore.Http.DefaultHttpContext.get_Items()
   at Abp.Runtime.Caching.Redis.AbpPerRequestRedisCache.TryGetValueAsync(String key)
   at Abp.Runtime.Caching.AbpCacheBase`2.GetAsync(TKey key, Func`2 factory)
System.ObjectDisposedException: IFeatureCollection has been disposed.
Object name: 'Collection'.
   at Microsoft.AspNetCore.Http.Features.FeatureReferences`1.ThrowContextDisposed()
   at Microsoft.AspNetCore.Http.DefaultHttpContext.get_Items()
   at Abp.Runtime.Caching.Redis.AbpPerRequestRedisCache.TryGetValueAsync(String key)
   at Abp.Runtime.Caching.AbpCacheBase`2.GetAsync(TKey key, Func`2 factory)

Is it a problem we can fix ? Is it due to redis data expiration policy ?

  • Abp 6.6.2
  • Angular
  • .NET 5

Hi,

As you know from my previous questions, I'm facing many performance issues while adding new users to the app. I'm dealing with multi instance on Azure, Redis cache, Azure SignalR...

The problem here is that some requests are very long to execute. Please look at following example :

As you can see, the request is blocked for 10s on token validation... On the left side of the screenshot you can see thaat the same request can be very fast. I suspect a lock somewhere in the app because all Azure resources are good (CPU, RAM...).

It is very hard to find the root cause from my side.

Can you please provide some help to find a solution ?

Showing 1 to 10 of 90 entries