aspnetzero .Net core and Angular
Regarding separate DB for each Tenant => We have one requirement where every time tenant gets created, we need to create separate DB for Tenant Currently it is working fine at my local environment. Separate DB is created for each tenant When I deploy my application on Azure, there I am getting execution timeout error when creating new Database for a tenant on Azure
We have one method in TenantManager.cs as _abpZeroDbMigrator.CreateOrMigrateForTenant(tenant) which runs synchronously. This is taking time to create DB and apply all migration which results in timeout exception Do you have any workaround for this issue?
We are working on a tight timeline with client. Any quick workaround/suggestion to resolve this would be highly appreacited.
Thanks
3 Answer(s)
-
0
Hi @omkarchoudhari
If you think the problem is related to duration of DB creation, you can move creation of database to a background job. When a new tenant created, you can create a background job to create tenant's database. You can check https://aspnetboilerplate.com/Pages/Documents/Background-Jobs-And-Workers
-
0
Hi @ismcagdas ,
We shifted the Database creation to a background job as per your suggestion. However, we are still getting the timeout exception.
ERROR 2020-05-06 11:31:34,987 [21 ] Mvc.ExceptionHandling.AbpExceptionFilter - Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. CREATE DATABASE operation failed. Internal service error. Microsoft.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. CREATE DATABASE operation failed. Internal service error. ---> System.ComponentModel.Win32Exception (258): The wait operation timed out. 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)Any other workaround or suggestion would be highly welcome !
-
0
I'm having the same issue, is there a solution for this problem?