Check the docs before asking a question: https://docs.abp.io/en/abp/latest/API/API-Versioning https://docs.abp.io/en/abp/7.3/UI/AspNetCore/Data-Tables
Check the samples to see the basic tasks: https://github.com/abpframework/abp-samples/tree/master/Api-Versioning [This example doesn't show how to integrate api versiong with Datatables ]
We have more than one version of one of our APIs.
We can easily see the versions through the Swagger
interface and working as intended.
JS proxy configuration from .Web
project as shown below;
(function(){
abp.utils.createNamespace(window, 'siemens.pSSX.odms.models.v130.model');
... ///
siemens.pSSX.odms.models.v130.model.getList = function(input, ajaxParams) {
var api_version = api_version ? api_version : '13.0';
return abp.ajax($.extend(true, {
url: abp.appPath + 'api/odms/models' + abp.utils.buildQueryString([{ name: 'filterText', value: input.filterText }, { name: 'name', value: input.name }, { name: 'description', value: input.description }, { name: 'serverName', value: input.serverName }, { name: 'cIMVersion', value: input.cIMVersion }, { name: 'creatorId', value: input.creatorId }, { name: 'creationTimeMin', value: input.creationTimeMin }, { name: 'creationTimeMax', value: input.creationTimeMax }, { name: 'lastModifierId', value: input.lastModifierId }, { name: 'lastModificationTimeMin', value: input.lastModificationTimeMin }, { name: 'lastModificationTimeMax', value: input.lastModificationTimeMax }, { name: 'sorting', value: input.sorting }, { name: 'skipCount', value: input.skipCount }, { name: 'maxResultCount', value: input.maxResultCount }, { name: 'api-version', value: input.api_version }]) + '',
type: 'GET'
}, ajaxParams));
};
})();
(function(){
abp.utils.createNamespace(window, 'siemens.pSSX.odms.models.v131.model');
siemens.pSSX.odms.models.v131.model.getList = function(input, ajaxParams) {
var api_version = api_version ? api_version : '13.1';
return abp.ajax($.extend(true, {
url: abp.appPath + 'api/odms/models' + abp.utils.buildQueryString([{ name: 'filterText', value: input.filterText }, { name: 'name', value: input.name }, { name: 'description', value: input.description }, { name: 'serverName', value: input.serverName }, { name: 'cIMVersion', value: input.cIMVersion }, { name: 'creatorId', value: input.creatorId }, { name: 'creationTimeMin', value: input.creationTimeMin }, { name: 'creationTimeMax', value: input.creationTimeMax }, { name: 'lastModifierId', value: input.lastModifierId }, { name: 'lastModificationTimeMin', value: input.lastModificationTimeMin }, { name: 'lastModificationTimeMax', value: input.lastModificationTimeMax }, { name: 'sorting', value: input.sorting }, { name: 'skipCount', value: input.skipCount }, { name: 'maxResultCount', value: input.maxResultCount }, { name: 'api-version', value: input.api_version }]) + '',
type: 'GET'
}, ajaxParams));
};
})();
For the sake of simplicity, two different MVC UI were designed for two different API versions.
var l = abp.localization.getResource("Odms");
var modelService = siemens.pSSX.odms.models.v130.model;
var getFilter = function () {
return {
filterText: $("#FilterText").val(),
name: $("#NameFilter").val(),
description: $("#DescriptionFilter").val(),
serverName: $("#ServerNameFilter").val(),
cIMVersion: $("#CIMVersionFilter").val(),
creatorId: $("#ServerNameFilter").val(),
creationTimeMin: $("#CreationTimeFilterMin").val(),
creationTimeMax: $("#CreationTimeFilterMax").val(),
lastModifierId: $("#ServerNameFilter").val(),
lastModificationTimeMin: $("#LastModificationTimeFilterMin").val(),
lastModificationTimeMax: $("#LastModificationTimeFilterMax").val(),
};
};
var dataTable = $("#ModelsTable").DataTable(abp.libs.datatables.normalizeConfiguration({
processing: true,
serverSide: true,
paging: true,
searching: false,
scrollX: true,
autoWidth: false,
scrollCollapse: true,
order: [[1, "asc"]],
ajax: **abp.libs.datatables.createAjax(modelService.getList, getFilter),**
columnDefs: [
{
... ///
}
]
}));
abp.libs.datatables.createAjax(modelService.getList, getFilter),
How can we specify a service API version when creating ajax ?
Log: 2023-09-18 20:21:27.944 +02:00 [INF] Request did not specify a service API version, but multiple candidate actions were found. Candidate actions: Siemens.PSSX.Odms.Models.v130.ModelController.GetListAsync (Siemens.PSSX.Odms.HttpApi) Siemens.PSSX.Odms.Models.v131.ModelController.GetListAsync (Siemens.PSSX.Odms.HttpApi)
context.Services.AddAuthentication()
//.AddAbpOpenIdConnect("myAuthSchema", "myAuth AD", options =>
.AddOpenIdConnect("myAuthSchema", "myAuth AD", options =>
{
options.Authority = configuration["AzureAd:Authority"].EnsureEndsWith('/') + configuration["AzureAd:TenantId"].EnsureEndsWith('/') + "v2.0".TrimEnd('/');
options.MetadataAddress = configuration["AzureAd:MetadataAddress"].EnsureEndsWith('/') + configuration["AzureAd:TenantId"].EnsureEndsWith('/') + "v2.0".EnsureEndsWith('/') + ".well-known/openid-configuration";
options.ResponseType = OpenIdConnectResponseType.CodeIdToken;
options.ClientId = configuration["AzureAd:ClientId"];
options.ClientSecret = configuration["AzureAd:ClientSecret"];
options.UsePkce = true;
options.GetClaimsFromUserInfoEndpoint = true;
options.TokenValidationParameters = new TokenValidationParameters()
{
ValidateIssuer = true,
};
options.TokenValidationParameters.ValidIssuers = new[]
{
configuration["AzureAd:MetadataAddress"],
configuration["AzureAd:Authority"]
};
options.Scope.Add("openid");
options.Scope.Add("profile");
options.Scope.Add("offline_access");
options.Scope.Add("email");
});
.WithDynamicOptions < OpenIdConnectOptions, OpenIdConnectHandler > (
"myAuthSchema",
options =>
{
options.WithProperty(x => x.ClientId);
options.WithProperty(x => x.ClientSecret, isSecret: true);
}
);
I would like to provide ClientId
and ClientSecret
values via Account External Provider Settings
/api/account/external-provider endpoint keeps returning only Google, Twitter and Microsoft values
I also tried to extend provider list via AbpExternalProviderOptions
but no luck
context.Services.Configure < AbpExternalProviderOptions > (options =>
{
options.Definitions.Add(new ExternalProviderDefinition()
{
Name = "Test",
Properties = new List < ExternalProviderDefinitionProperty >()
});
});
What am i missing ?
Hello, We can load module classes as plug-ins without adding reference to project. The relevant explanation is https://docs.abp.io/en/abp/latest/PlugIn-Modules located at here.
Where should we define MyPlugInDemoWebModule class in this example?
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity.PlugIns;
namespace MyPlugInDemo.Web
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<MyPlugInDemoWebModule>(options =>
{
options.PlugInSources.AddFolder(@"D:\Temp\MyPlugIns");
});
}
public void Configure(IApplicationBuilder app)
{
app.InitializeApplication();
}
}
}
This sample code does not seem updated.
Can we replace ConfigureServices(IServiceCollection services) part with
public override void ConfigureServices(ServiceConfigurationContext context)
{
}
and Configure(IApplicationBuilder app) part with
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
app.InitializeApplication();
}
More importantly, Can you share an example where we consume a service in a project that we did add as reference
For example, I want to call MyService : IMyService, ITransientDependency that we created in the plug-in
private static ApplicationMenuItem AddModuleMenuItem(MenuConfigurationContext context)
{
var l = context.GetLocalizer<TestModuleResource>();
var moduleMenu = new ApplicationMenuItem(
TestModuleMenus.Prefix,
displayName: l["Menu:TestModule"],
"~/TestModule",
icon: "fa fa-globe");
//Add main menu items.
context.Menu.Items.AddIfNotContains(moduleMenu);
return moduleMenu;
}
I believe that it is related with virtual file configuration of the Web.Host template File path needs to be Domain.Shared not Domain
Most possible it is due to missing Volo.Abp.Account.Pro.Admin.HttpApi.Client package at .Web.Host template
Is it related with https://support.abp.io/QA/Questions/4677/User-lost-credentials-after-30min-without-activity or https://github.com/abpframework/abp/issues/14068
1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable
1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList
1 entriesToSave, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func
4 verifySucceeded, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Volo.Abp.EntityFrameworkCore.AbpDbContext1.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) --- End of inner exception stack trace --- at Volo.Abp.EntityFrameworkCore.AbpDbContext
1.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Volo.Abp.Uow.UnitOfWork.SaveChangesAsync(CancellationToken cancellationToken)
at Volo.Abp.Uow.UnitOfWork.CompleteAsync(CancellationToken cancellationToken)
at Volo.Abp.AspNetCore.Mvc.Uow.AbpUowActionFilter.OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)There is a nice documentation and blog post on how to check concurrency (https://docs.abp.io/en/abp/latest/Concurrency-Check), but there is no example on how to resolve conflicts manually. I don't understand how we can access the "values" (values on db, submitted data etc) in case of conflict.
The SaveChangesAsync() function throws AbpDbConcurrencyException not DbUpdateConcurrencyException
The AbpDbConcurrencyException class does not derive from the DbUpdateConcurrencyException class.
For this reason, I cannot access the Current/Original/Database values of the entity. (https://learn.microsoft.com/en-us/ef/core/saving/concurrency#resolving-concurrency-conflicts)
Can you share an example about the resolving concurrency conflicts ? Existing framework documentation doesn't provide any info resolving concurrency.
ABP-LIC-0013 - License exception: ABP-LIC-0023: An error occured while calling the license server! The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. Error occured while getting the latest version from https://abp.io/api/download/template/get-version/ : Remote server returns '403-Forbidden'. Message: Pro templates require a commercial license! Should login to be able to download a pro template.
And also is this UI issue ? Why we can't set status to non-private ?
ABP Framework version: v5.3.3
UI type: MVC
DB provider: EF Core
Tiered (MVC) or Identity Server Separated (Angular): yes
Exception message and stack trace:
2022-09-21 12:35:43.088 +00:00 [ERR] content length must be equal to or lower than 65535! (Parameter 'content')
System.ArgumentException: content length must be equal to or lower than 65535! (Parameter 'content')
at Volo.Abp.Check.NotNullOrWhiteSpace(String value, String parameterName, Int32 maxLength, Int32 minLength) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Core\Volo\Abp\Check.cs:line 82
at Volo.Abp.TextTemplateManagement.TextTemplates.TextTemplateContent.SetContent(String content)
at Volo.Abp.TextTemplateManagement.TextTemplates.TextTemplateContent..ctor(Guid id, String name, String content, String cultureName, Nullable1 tenantId) at Volo.Abp.TextTemplateManagement.TextTemplates.TemplateContentAppService.UpdateAsync(UpdateTemplateContentInput input) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue
1.ProceedAsync() in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAbpMethodInvocationAdapterWithReturnValue.cs:line 25
at Volo.Abp.Authorization.AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Authorization\Volo\Abp\Authorization\AuthorizationInterceptor.cs:line 20
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAsyncAbpInterceptorAdapter.cs:line 34
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAbpMethodInvocationAdapterWithReturnValue.cs:line 25 at Volo.Abp.GlobalFeatures.GlobalFeatureInterceptor.InterceptAsync(IAbpMethodInvocation invocation) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.GlobalFeatures\Volo\Abp\GlobalFeatures\GlobalFeatureInterceptor.cs:line 26 at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter
1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAsyncAbpInterceptorAdapter.cs:line 34 at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue
1.ProceedAsync() in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAbpMethodInvocationAdapterWithReturnValue.cs:line 25
at Volo.Abp.Auditing.AuditingInterceptor.ProceedByLoggingAsync(IAbpMethodInvocation invocation, IAuditingHelper auditingHelper, IAuditLogScope auditLogScope) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Auditing\Volo\Abp\Auditing\AuditingInterceptor.cs:line 103
at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Auditing\Volo\Abp\Auditing\AuditingInterceptor.cs:line 49
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAsyncAbpInterceptorAdapter.cs:line 34
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAbpMethodInvocationAdapterWithReturnValue.cs:line 25 at Volo.Abp.Features.FeatureInterceptor.InterceptAsync(IAbpMethodInvocation invocation) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Features\Volo\Abp\Features\FeatureInterceptor.cs:line 29 at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter
1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAsyncAbpInterceptorAdapter.cs:line 34 at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue
1.ProceedAsync() in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAbpMethodInvocationAdapterWithReturnValue.cs:line 25
at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Validation\Volo\Abp\Validation\ValidationInterceptor.cs:line 20
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAsyncAbpInterceptorAdapter.cs:line 34
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAbpMethodInvocationAdapterWithReturnValue.cs:line 25 at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Uow\Volo\Abp\Uow\UnitOfWorkInterceptor.cs:line 53 at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter
1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAsyncAbpInterceptorAdapter.cs:line 34 at Volo.Abp.TextTemplateManagement.TextTemplates.TemplateContentController.UpdateAsync(UpdateTemplateContentInput input) at lambda_method13416(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask
1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Steps to reproduce the issue:"
Why there is such a limit ?
1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource
1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource
1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1 retry) at System.Data.SqlClient.SqlConnection.Open() at Hangfire.SqlServer.SqlServerStorage.CreateAndOpenConnection() at Hangfire.SqlServer.SqlServerStorage.UseConnection[T](DbConnection dedicatedConnection, Func
2 func)
at Hangfire.SqlServer.SqlServerStorage.Initialize()
ClientConnectionId:818770b2-7b19-493b-974a-ffce2693698f
Error Number:4060,State:1,Class:11 GlobalConfiguration.Configuration
// Use custom connection string
.UseSqlServerStorage(configuration.GetConnectionString("Default"));
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
Configure<AbpBackgroundJobOptions>(options =>
{
options.IsJobExecutionEnabled = false;
});
Configure<AbpBackgroundWorkerOptions>(options =>
{
options.IsEnabled = false;
});
}
AbpBackgroundWorkersHangfireModule on pre application initilization stage :
public async override Task OnPreApplicationInitializationAsync(ApplicationInitializationContext context)
{
var options = context.ServiceProvider.GetRequiredService<IOptions<AbpBackgroundWorkerOptions>>().Value;
if (!options.IsEnabled)
{
var hangfireOptions = context.ServiceProvider.GetRequiredService<IOptions<AbpHangfireOptions>>().Value;
hangfireOptions.BackgroundJobServerFactory = CreateOnlyEnqueueJobServer;
}
await context.ServiceProvider
.GetRequiredService<IBackgroundWorkerManager>()
.StartAsync();
}