Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "Ricavir"

Hi,

Is there a way to get Hangfire job context with ABP 9.3 ? I need to get "retryCount" value on job execution.

This should be possible with following Hangfire command : JobStorage.Current.GetConnection().GetJobParameter(jobId, "RetryCount")

I tried it by adding Hangfire nuget package directly but I'm getting a dependency error :

'MyJob' is waiting for the following dependencies:
- Service 'Hangfire.Server.PerformContext' which was not registered.

Hi support team,

I'm facing an issue with abp 9.3.0. We have a bacground job that updates some tenant data. Data is being saved successfuly.

I wanted to avoid loosing LastModifierUserId in this case.

Thus, I'm using UnitOfWorkManager.Current.DisableAuditing(AbpAuditFields.LastModifierUserId, AbpAuditFields.LastModificationTime)

But this is only preventing LastModificationTime to be updated. LastModifierUserId is being saved as null value and I don't understand why.

Here is the code :

public class UpdateStatusJob : AsyncBackgroundJob<UpdateStatusJobArgs>, ITransientDependency
{
    private readonly IDataManager _dataManager;
    private readonly IUnitOfWorkManager _unitOfWorkManager;
    private readonly IInvoiceManager _invoiceManager;

    public UpdateStatusJob(IDataManager dataManager,
                              IInvoiceManager invoiceManager,
                              IUnitOfWorkManager unitOfWorkManager)
    {
        _unitOfWorkManager = unitOfWorkManager;
        _dataManager = dataManager;
        _invoiceManager = invoiceManager;
    }

    public override async Task ExecuteAsync(UpdateStatusJobArgs args)
    {
        await _unitOfWorkManager.WithUnitOfWorkAsync(async () =>
        {
            using (UnitOfWorkManager.Current.SetTenantId(args.TenantId))
            {
                using (UnitOfWorkManager.Current.DisableAuditing(AbpAuditFields.LastModifierUserId, AbpAuditFields.LastModificationTime))
                {                    
                    if (args.InvoiceId.HasValue)
                    {
                        //Initialize job 
                        var invoiceReport = await _invoiceManager.GetInvoice(args.InvoiceId.Value);
                        var updateResult = await _dataManager.UpdateStatus(invoiceReport, args.TenantId);
                        if (updateResult.Success == false)
                        {
                            new Exception("Updating invoice status failed !");
                        }
                    }
                }
            }
        });
    }
}

I can see in debug that LastModifierUserId is disabled in current UOW. When looking at the logs, I can see following SQL request :

UPDATE [AbpTenants] SET [AdditionalCreditAmount] = @p0
OUTPUT 1
WHERE [Id] = @p1;
UPDATE [LInvoices] SET [Status] = @p2, [IsCreditUsed] = @p3, [LastModifierUserId] = @p4
OUTPUT 1
WHERE [Id] = @p5;

I've tested several ways to begin UOW but the issue is always the same.

Do you see something wrong here ? Is it a bug on the framework ?

Hi,

I'm using ABP ZERO (abp 8.2.0) with Angular 15 (abp-web-resources ^5.7.0). For some reason, I'm getting an Internal Server Error on some POST requests . The error is :

POST https://mywebsite.com/api/services/app/QuoteType/CreateOrUpdateQuoteType   500 (Internal Server Error)
WARN:
Content-Type is not sent!

Right now, this is occuring only on Chrome browsers. If I wait 5 or 10 minutes, the same request is sent correctly (wihtout doing anything else).

When the problem occurs, If I switch to a different brower (let say Edge), the problem do not occur for the same request. We noticed that this can happen in one specific POST request or, sometimes, to all requests.

Should be then an issue on client side.

Can you please provide some help to resolve this ?

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

Showing 1 to 10 of 93 entries