yuzd / Hangfire.HttpJob

httpjob for Hangfire,restful api for Hangfire,job调度与业务分离
https://github.com/yuzd/Hangfire.HttpJob/wiki
MIT License
635 stars 187 forks source link

运行postgresql测试项目报错 #146

Closed GaryQiao closed 2 years ago

GaryQiao commented 2 years ago

您好,抱歉使用中遇到了些问题,烦请帮忙看看

问题1:运行官方PostgreSqlHangfire demo,只是修改pg连接字符串,没有修改任务代码报错

System.TypeLoadException:“Method 'SearchWeightedTags' in type 'Hangfire.Tags.PostgreSql.PostgreSqlTagsServiceStorage' from assembly 'Hangfire.Tags.PostgreSql, Version=1.7.1.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.”

问题2:升级了nuget包后,可以运行PostgreSqlHangfire 和 TestHangfirePostgreSqlAgent:手动执行TestJob报错

+270ms任务开始执行,执行时间:2022-03-30 11:19:17 +291ms任务名称:单例job|队列名称:recurring +310ms参数:【{"Success":null,"Fail":null,"RecurringJobIdentifier":"TestHangfirePostgreSqlAgent.Jobs.TestJob","Url":"http://localhost:5002/jobagent","Method":"Post","Data":"","ContentType":"application/json","Timeout":20000,"DelayFromMinutes":15,"RunAt":null,"Cron":"","JobName":"单例job","QueueName":"recurring","AgentClass":"TestHangfirePostgreSqlAgent.Jobs.TestJob,TestHangfirePostgreSqlAgent","AgentTimeout":0,"SendSuccess":false,"SendFail":false,"Mail":"","EnableRetry":false,"RetryDelaysInSeconds":null,"RetryTimes":0,"BasicUserName":"admin","BasicPassword":"123456","Headers":{},"CallbackEL":null,"TimeZone":null,"DingTalk":null}】 +529msHttp状态码:InternalServerError +545ms执行结果:System.ArgumentNullException: Value cannot be null. (Parameter '_connectionString') at Hangfire.HttpJob.Agent.PostgreSqlConsole.PostgreSqlStorage..ctor(PostgreSqlStorageOptions pgSqlStorageOptions) at Hangfire.HttpJob.Agent.PostgreSqlConsole.PostgreSqlStorage..ctor(IOptions1 pgSqlStorageOptions) at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.b__0(ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider) at Hangfire.HttpJob.Agent.JobAgentMiddleware.GetService[T](HttpContext httpContext) at Hangfire.HttpJob.Agent.JobAgentMiddleware.GetHangfireStorage(HttpContext httpContext, JobItem jobItem) at Hangfire.HttpJob.Agent.JobAgentMiddleware.InvokeAsync(HttpContext httpContext, RequestDelegate next) +573ms任务结束:2022-03-30 11:19:17

yuzd commented 2 years ago

我看看

yuzd commented 2 years ago

修复了 你再测试下看看呢