it appears changing these worked. However, I am running into another upgrade issue.
I have added this line of code to my HostApi.Host startup.cs
app.UseHangfireDashboard("/hangfire",new DashboardOptions { AsyncAuthorization = new[] { new AbpHangfireAuthorizationFilter(requiredPermissionName: "hangfirePerm") } });
When I try to access hangfire on /hangfire I get page can not be found error. log file entries are below.
SELECT TOP(@__p_1) [a].[Id], [a].[ConcurrencyStamp], [a].[CreationTime], [a].[ExtraProperties], [a].[IsAbandoned], [a].[JobArgs], [a].[JobName], [a].[LastTryTime], [a].[NextTryTime], [a].[Priority], [a].[TryCount] FROM [AbpBackgroundJobs] AS [a] WHERE ([a].[IsAbandoned] = CAST(0 AS bit)) AND ([a].[NextTryTime] <= @__now_0) ORDER BY [a].[Priority] DESC, [a].[TryCount], [a].[NextTryTime] 2021-12-27 09:21:55.711 -05:00 [INF] Request starting HTTP/2 GET https://localhost:44350/hangfire - - 2021-12-27 09:21:55.713 -05:00 [INF] Request finished HTTP/2 GET https://localhost:44350/hangfire - - - 401 - - 2.2855ms 2021-12-27 09:21:59.831 -05:00 [INF] Entity Framework Core 6.0.1 initialized 'BackgroundJobsDbContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer:6.0.0' with options: QuerySplittingBehavior=SplitQuery 2021-12-27 09:21:59.832 -05:00 [INF] Executed DbCommand (1ms) [Parameters=[@__p_1='?' (DbType = Int32), @__now_0='?' (DbType = DateTime2)], CommandType='"Text"', CommandTimeout='30'] SELECT TOP(@__p_1) [a].[Id], [a].[ConcurrencyStamp], [a].[CreationTime], [a].[ExtraProperties], [a].[IsAbandoned], [a].[JobArgs], [a].[JobName], [a].[LastTryTime], [a].[NextTryTime], [a].[Priority], [a].[TryCount] FROM [AbpBackgroundJobs] AS [a] WHERE ([a].[IsAbandoned] = CAST(0 AS bit)) AND ([a].[NextTryTime] <= @__now_0) ORDER BY [a].[Priority] DESC, [a].[TryCount], [a].[NextTryTime]
If I change the code back to app.UseHangfireDashboard(); things appear to be working properly. What could be missing?
When you say use. Are you referring to referring the package in one of the projects or something else?
2021-12-23 13:48:07.478 -05:00 [INF] Starting TiberVendor.HttpApi.Host.
2021-12-23 13:48:15.185 -05:00 [INF] User profile is available. Using 'C:\Users\ryanr\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
2021-12-23 13:48:15.549 -05:00 [INF] Start installing Hangfire SQL objects...
2021-12-23 13:48:15.697 -05:00 [INF] Hangfire SQL objects installed.
2021-12-23 13:48:15.757 -05:00 [INF] Starting Hangfire Server using job storage: 'SQL Server: localhost\SQLEXPRESS@TiberVendorAng'
2021-12-23 13:48:15.758 -05:00 [INF] Using the following options for SQL Server job storage: Queue poll interval: 00:00:15.
2021-12-23 13:48:15.758 -05:00 [INF] Using the following options for Hangfire Server:
Worker count: 20
Listening queues: 'default'
Shutdown timeout: 00:00:15
Schedule polling interval: 00:00:15
2021-12-23 13:48:15.771 -05:00 [DBG] Execution loop BackgroundServerProcess:90579595 has started in 10.2107 ms
2021-12-23 13:48:15.772 -05:00 [INF] Initializing UI Database
2021-12-23 13:48:15.826 -05:00 [INF] Server desktop-2dfljpm:70276:c8f0680d caught stopping signal...
2021-12-23 13:48:15.829 -05:00 [INF] Server desktop-2dfljpm:70276:c8f0680d caught stopped signal...
2021-12-23 13:48:15.890 -05:00 [INF] Server desktop-2dfljpm:70276:c8f0680d successfully announced in 108.9271 ms
2021-12-23 13:48:15.895 -05:00 [DBG] Execution loop ServerHeartbeatProcess:e120c096 has started in 3.9227 ms
2021-12-23 13:48:15.895 -05:00 [INF] Server desktop-2dfljpm:70276:c8f0680d is starting the registered dispatchers: ServerWatchdog, ServerJobCancellationWatcher, ExpirationManager, CountersAggregator, SqlServerHeartbeatProcess, Worker, DelayedJobScheduler, RecurringJobScheduler...
2021-12-23 13:48:15.895 -05:00 [DBG] Execution loop ServerHeartbeatProcess:e120c096 stopped in 4.1088 ms
2021-12-23 13:48:15.899 -05:00 [DBG] Execution loop ServerWatchdog:17bccc67 has started in 4.3167 ms
2021-12-23 13:48:15.899 -05:00 [DBG] Execution loop ServerWatchdog:17bccc67 stopped in 4.3574 ms
2021-12-23 13:48:15.904 -05:00 [DBG] Execution loop ServerJobCancellationWatcher:e29f6cba has started in 6.7077 ms
2021-12-23 13:48:15.904 -05:00 [DBG] Execution loop ServerJobCancellationWatcher:e29f6cba stopped in 6.821 ms
2021-12-23 13:48:15.910 -05:00 [DBG] Execution loop ExpirationManager:0725f7c2 has started in 8.0649 ms
2021-12-23 13:48:15.910 -05:00 [DBG] Execution loop ExpirationManager:0725f7c2 stopped in 8.1971 ms
2021-12-23 13:48:15.913 -05:00 [DBG] Execution loop CountersAggregator:439be6c0 has started in 6.2212 ms
2021-12-23 13:48:15.913 -05:00 [DBG] Execution loop CountersAggregator:439be6c0 stopped in 6.2547 ms
2021-12-23 13:48:15.919 -05:00 [DBG] Execution loop SqlServerHeartbeatProcess:f4e344fc has started in 5.6444 ms
2021-12-23 13:48:15.919 -05:00 [DBG] Execution loop SqlServerHeartbeatProcess:f4e344fc stopped in 5.6894 ms
2021-12-23 13:48:15.925 -05:00 [DBG] Execution loop Worker:24d2f18b has started in 7.6708 ms
2021-12-23 13:48:15.925 -05:00 [DBG] Execution loop Worker:24d2f18b stopped in 7.934 ms
2021-12-23 13:48:15.928 -05:00 [DBG] Execution loop Worker:c05070a1 has started in 11.4221 ms
2021-12-23 13:48:15.928 -05:00 [DBG] Execution loop Worker:c05070a1 stopped in 11.4885 ms
2021-12-23 13:48:15.933 -05:00 [DBG] Execution loop Worker:c7f005dc has started in 16.3926 ms
2021-12-23 13:48:15.934 -05:00 [DBG] Execution loop Worker:c7f005dc stopped in 16.4976 ms
2021-12-23 13:48:15.936 -05:00 [DBG] Execution loop Worker:cd7fd0ba has started in 19.1263 ms
2021-12-23 13:48:15.937 -05:00 [DBG] Execution loop Worker:cd7fd0ba stopped in 19.5377 ms
2021-12-23 13:48:15.944 -05:00 [DBG] Execution loop Worker:9cf54cf7 has started in 26.5275 ms
2021-12-23 13:48:15.944 -05:00 [DBG] Execution loop Worker:9cf54cf7 stopped in 27.4965 ms
2021-12-23 13:48:15.946 -05:00 [DBG] Execution loop Worker:62148920 has started in 29.282 ms
2021-12-23 13:48:15.946 -05:00 [DBG] Execution loop Worker:62148920 stopped in 29.3286 ms
2021-12-23 13:48:15.951 -05:00 [DBG] Execution loop Worker:8f4d5267 has started in 33.1531 ms
2021-12-23 13:48:15.951 -05:00 [DBG] Execution loop Worker:8f4d5267 stopped in 33.5867 ms
2021-12-23 13:48:15.957 -05:00 [DBG] Execution loop Worker:0146fb59 has started in 40.3228 ms
2021-12-23 13:48:15.957 -05:00 [DBG] Execution loop Worker:0146fb59 stopped in 40.4706 ms
2021-12-23 13:48:15.962 -05:00 [DBG] Execution loop Worker:c23324b3 has started in 45.0744 ms
2021-12-23 13:48:15.962 -05:00 [DBG] Execution loop Worker:c23324b3 stopped in 45.5077 ms
2021-12-23 13:48:15.965 -05:00 [DBG] Execution loop Worker:aa8ade2e has started in 47.5985 ms
2021-12-23 13:48:15.965 -05:00 [DBG] Execution loop Worker:aa8ade2e stopped in 47.6411 ms
2021-12-23 13:48:15.970 -05:00 [DBG] Execution loop Worker:d83114e5 has started in 53.1525 ms
2021-12-23 13:48:15.970 -05:00 [DBG] Execution loop Worker:d83114e5 stopped in 53.3358 ms
2021-12-23 13:48:15.976 -05:00 [DBG] Execution loop Worker:584bf70f has started in 58.9081 ms
2021-12-23 13:48:15.977 -05:00 [DBG] Execution loop Worker:584bf70f stopped in 59.5967 ms
2021-12-23 13:48:15.979 -05:00 [DBG] Execution loop Worker:3ee042b1 has started in 61.853 ms
2021-12-23 13:48:15.979 -05:00 [DBG] Execution loop Worker:3ee042b1 stopped in 62.2163 ms
2021-12-23 13:48:15.983 -05:00 [DBG] Execution loop Worker:6e7617aa has started in 65.8995 ms
2021-12-23 13:48:15.983 -05:00 [DBG] Execution loop Worker:6e7617aa stopped in 65.9383 ms
2021-12-23 13:48:15.989 -05:00 [DBG] Execution loop Worker:c394413a has started in 72.3089 ms
2021-12-23 13:48:15.990 -05:00 [DBG] Execution loop Worker:c394413a stopped in 73.0446 ms
2021-12-23 13:48:15.992 -05:00 [DBG] Execution loop Worker:81c10c93 has started in 75.2019 ms
2021-12-23 13:48:15.992 -05:00 [DBG] Execution loop Worker:81c10c93 stopped in 75.2302 ms
2021-12-23 13:48:15.997 -05:00 [DBG] Execution loop Worker:307e71f8 has started in 80.2291 ms
2021-12-23 13:48:15.997 -05:00 [DBG] Execution loop Worker:307e71f8 stopped in 80.2583 ms
2021-12-23 13:48:16.001 -05:00 [DBG] Execution loop Worker:9fc6b0fc has started in 84.2354 ms
2021-12-23 13:48:16.001 -05:00 [DBG] Execution loop Worker:9fc6b0fc stopped in 84.3294 ms
2021-12-23 13:48:16.004 -05:00 [DBG] Execution loop Worker:642a441b has started in 87.3229 ms
2021-12-23 13:48:16.006 -05:00 [DBG] Execution loop Worker:642a441b stopped in 88.8779 ms
2021-12-23 13:48:16.009 -05:00 [DBG] Execution loop Worker:50e592a0 has started in 91.8216 ms
2021-12-23 13:48:16.009 -05:00 [DBG] Execution loop Worker:50e592a0 stopped in 91.8739 ms
2021-12-23 13:48:16.014 -05:00 [INF] Server desktop-2dfljpm:70276:c8f0680d all the dispatchers started
2021-12-23 13:48:16.014 -05:00 [DBG] Execution loop DelayedJobScheduler:2539bd3f has started in 10.2585 ms
2021-12-23 13:48:16.014 -05:00 [DBG] Execution loop DelayedJobScheduler:2539bd3f stopped in 10.3319 ms
2021-12-23 13:48:16.017 -05:00 [DBG] Execution loop RecurringJobScheduler:dfdfa40a has started in 4.7769 ms
2021-12-23 13:48:16.017 -05:00 [DBG] Execution loop RecurringJobScheduler:dfdfa40a stopped in 4.8079 ms
2021-12-23 13:48:16.021 -05:00 [INF] Server desktop-2dfljpm:70276:c8f0680d All dispatchers stopped
2021-12-23 13:48:16.025 -05:00 [INF] Server desktop-2dfljpm:70276:c8f0680d successfully reported itself as stopped in 2.7547 ms
2021-12-23 13:48:16.025 -05:00 [INF] Server desktop-2dfljpm:70276:c8f0680d has been stopped in total 199.2083 ms
2021-12-23 13:48:16.025 -05:00 [DBG] Execution loop BackgroundServerProcess:90579595 stopped in 199.2965 ms
2021-12-23 13:48:16.042 -05:00 [FTL] Host terminated unexpectedly!
Autofac.Core.DependencyResolutionException: An exception was thrown while activating HealthChecks.UI.Core.Data.HealthChecksDb.
---> Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(Microsoft.EntityFrameworkCore.DbContextOptions`1[HealthChecks.UI.Core.Data.HealthChecksDb])' on type 'HealthChecksDb'.
---> System.TypeLoadException: Method 'GetServiceProviderHashCode' in type 'ExtensionInfo' from assembly 'Microsoft.EntityFrameworkCore.InMemory, Version=5.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation.
at Microsoft.EntityFrameworkCore.InMemory.Infrastructure.Internal.InMemoryOptionsExtension.get_Info()
at Microsoft.EntityFrameworkCore.DbContextOptions.GetHashCode()
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd[TArg](TKey key, Func`3 valueFactory, TArg factoryArgument)
at Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.GetOrAdd(IDbContextOptions options, Boolean providerRequired)
at Microsoft.EntityFrameworkCore.DbContext..ctor(DbContextOptions options)
at lambda_method21(Closure , Object[] )
at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
--- End of inner exception stack trace ---
at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
at Autofac.Core.Activators.Reflection.ReflectionActivator.<ConfigurePipeline>b__11_0(ResolveRequestContext ctxt, Action`1 next)
at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
--- End of inner exception stack trace ---
at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext ctxt)
at Autofac.Core.Resolving.Middleware.RegistrationPipelineInvokeMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
at Autofac.Core.Resolving.Middleware.SharingMiddleware.<>c__DisplayClass5_0.<Execute>b__0()
at Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid id, Func`1 creator)
at Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid primaryId, Nullable`1 qualifyingId, Func`1 creator)
at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext ctxt)
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request)
at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request)
at Autofac.Core.Resolving.ResolveOperation.Execute(ResolveRequest request)
at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest request)
at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType)
at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at HealthChecks.UI.Core.HostedService.UIInitializationHostedService.InitializeDatabase(IServiceProvider sp)
at HealthChecks.UI.Core.HostedService.UIInitializationHostedService.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
at TiberVendor.Program.Main(String[] args) in C:\source\repos\_TiberVendor\VendorDatabase\aspnet-core\src\TiberVendor.HttpApi.Host\Program.cs:line 31
Since this is mainly ABP code. Where should I look and compare?
So I regenerated the table with a different name with ABP SUITE and now things seem to be working. What I would like to understand is why did the original not work properly as it was generated with ABP Suite?
I went in and attempted to use .Include, but it appears .Include is not part of the IQueryable. A little background. I am using the IQueryable because when I inject the service and attempt to use the service directly in a background job I get Access denied because the user isnt authenticated, so instead I am accessing the data using the IRepository<Trap, Guid>. I have done this in other background jobs without any issues, but this one is throwing an exception and not sure why.
I'll give that a try in the AM. I'll tell you know what happens.
Not sure I am understanding. Here is what I have
private readonly IUnitOfWorkManager _unitOfWorkManager; private readonly IRepository<Trap, Guid> _trapsSheet; private readonly IObjectMapper _objectMapper; private readonly IEmailSender _emailSender; private readonly ITemplateRenderer _templateRenderer; private static readonly string[] Scopes = { SheetsService.Scope.Spreadsheets };
public TrapLoader(IUnitOfWorkManager unitOfWorkManager, IRepository<Trap, Guid> traps, IObjectMapper objectMapper, IEmailSender emailSender, ITemplateRenderer templateRenderer) { _unitOfWorkManager = unitOfWorkManager; ** _trapsSheet = traps**; _objectMapper = objectMapper; _emailSender = emailSender; _templateRenderer = templateRenderer; }
The funny part is, I can insert records just fine with this code. This is within the same class for the background job.
try { Trap _result = MapValues(row); System.Diagnostics.Debug.WriteLine(_result.Asset.ToString()); mTrap.Add(_result);
}catch(Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); }
if(mTrap.Count > 0) { await _trapsSheet.InsertManyAsync(mTrap, true); await uow.SaveChangesAsync(); }