I have a customer scenario, so the application when it starts, it waiting for external event (using a third party), when the event is happend, But when the event is triggered, I should be able to use dependency injection, When I try to access the Service Provider, I get the error above, here is a code sample:
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var configuration = context.GetConfiguration();
var SelfUrl = configuration["App:SelfUrl"];
var app = context.GetApplicationBuilder();
var env = context.GetEnvironment();
var buses = context.ServiceProvider.GetServices<ServiceBusProcessor>();
foreach (var processor1 in buses)
{
processor1.ProcessMessageAsync += (ProcessMessageEventArgs args) => ProcessMessageHandler(context, args);
processor1.ProcessErrorAsync += ErrorHandler;
processor1.StartProcessingAsync().GetAwaiter().GetResult();
}
}
private async Task ProcessMessageHandler(ApplicationInitializationContext context, ProcessMessageEventArgs args) {
var serviceProvider = context.ServiceProvider ;
using (var scope = serviceProvider.CreateScope())
{
var handler = serviceProvider.GetService<TraineeProfileUpdateJobHandler>(); // this is throws an error
var handler2 = scope.ServiceProvider.GetService<TraineeProfileUpdateJobHandler>(); // this is throws an error
await handler.ExecuteAsync(parsed);
}
}
2023-05-21 17:07:47.946 +03:00 [ERR] An exception was thrown while deserializing the token. Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The antiforgery token could not be decrypted. ---> System.Security.Cryptography.CryptographicException: The key {d8fbc7f5-259b-455a-b1f4-89121eb1d364} was not found in the key ring. For more information go to http://aka.ms/dataprotectionwarning at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status) at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.DangerousUnprotect(Byte[] protectedData, Boolean ignoreRevocationErrors, Boolean& requiresMigration, Boolean& wasRevoked) at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte[] protectedData) at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgeryTokenSerializer.Deserialize(String serializedToken) --- End of inner exception stack trace --- at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgeryTokenSerializer.Deserialize(String serializedToken) at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery.GetCookieTokenDoesNotThrow(HttpContext httpContext)
Hi,
Did not work, Please note that:
And I tried to create a new project with the same setup I got the same error
An unhandled exception occurred while processing the request. AbpException: Could not find the bundle file '/libs/bootstrap/css/bootstrap.rtl.css' for the bundle 'Lepton.Global'! Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers.AbpTagHelperResourceService.ProcessAsync(ViewContext viewContext, TagHelper tagHelper, TagHelperContext context, TagHelperOutput output, List<BundleTagHelperItem> bundleItems, string bundleName)
Stack Query Cookies Headers Routing AbpException: Could not find the bundle file '/libs/bootstrap/css/bootstrap.rtl.css' for the bundle 'Lepton.Global'! Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers.AbpTagHelperResourceService.ProcessAsync(ViewContext viewContext, TagHelper tagHelper, TagHelperContext context, TagHelperOutput output, List<BundleTagHelperItem> bundleItems, string bundleName) Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers.AbpBundleTagHelperService<TTagHelper, TService>.ProcessAsync(TagHelperContext context, TagHelperOutput output) Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.<RunAsync>g__Awaited|0_0(Task task, TagHelperExecutionContext executionContext, int i, int count) AspNetCore._Themes_Lepton_Layouts_Account_Default+<>c__DisplayClass32_0+<<ExecuteAsync>b__0>d.MoveNext() in Default.cshtml + <abp-style-bundle name="@LeptonThemeBundles.Styles.Global" /> Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.SetOutputContentAsync() AspNetCore._Themes_Lepton_Layouts_Account_Default.ExecuteAsync() in Default.cshtml + <html lang="@CultureInfo.CurrentCulture.Name" dir="@langDir"> Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context) Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, bool invokeViewStarts) Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter bodyWriter)
I could make this work by using the following code:
public override void PostConfigureServices(ServiceConfigurationContext context) { var configuration = context.Services.GetConfiguration(); var serverName = configuration.GetValue<string>("Schedule:ServerName"); var workerCount = configuration.GetValue<int>("Schedule:WorkerCount"); if (!string.IsNullOrEmpty(serverName) && workerCount > 0) { Configure<AbpHangfireOptions>(options => { options.ServerOptions = new BackgroundJobServerOptions { WorkerCount = workerCount, ServerName = serverName, Queues = new string[] { "default" , "logs"}, }; }); } base.PostConfigureServices(context); }
Still cannot limit the execution time for job instance, so any job does not work more than 5 minutes for example
Thank you for your response, Can you provide me more details about the first point:
Typically there is only one hangfire server per application instance, you can use AbpHangfireOptions to create hangfire server instance if you want.
Currently I add hangfire using the following code:
GlobalConfiguration.Configuration.UseSqlServerStorage(configuration.GetConnectionString("Default-hangfire"));
context.Services.AddHangfire(config =>
{
config.UseSqlServerStorage(configuration.GetConnectionString("Default-hangfire"), options: ops);
});
Thank you
I need to configure Hangfire with abp 4.2.1 I need to do the following: 1- Control the number of instances of each server 2- Divide jobs into queues, I want to add some queues dynamically 3- I need to add more servers (I can create a replica of the Host project), But I need to configure with job work on which server 4- I want to control the time span between jobs in the same queue 5- I want to be able to configure AddHangfireServer not only AddHangfire
Thank you
Dear Support team, any update on the original issue?
Hello,
What is your angular version?
Is the defaultProject property exists in your
angular.json
?We know defaultProject deprecated with angular 14. And we fixed proxy generation. The fix will be available in 6.0.2
Same error here, abp version 6.0.1, prompt enter target Angular project to place the generated code. when execute
generate-proxy -t ng
for the Application Module project type.So what's the time for releasing 6.0.2?
That does not solve the problem!
Dear Support team, any update on the original issue?
Any update Please :) ?