colinin / abp-next-admin

这是基于vue-vben-admin 模板适用于abp Vnext的前端管理项目
MIT License
806 stars 248 forks source link

JGSoft.Abp.BackgroundTasks.Jobs 调度器问题 #935

Closed lszai90 closed 2 months ago

lszai90 commented 2 months ago

INSERT INTO JGSRM-v4.TK_BackgroundJobs (Id, TenantId, Name, Group, Type, Result, Args, Status, IsEnabled, Description, LockTimeOut, BeginTime, EndTime, LastRunTime, NextRunTime, JobType, Cron, Source, Priority, TriggerCount, TryCount, MaxTryCount, MaxCount, Interval, IsAbandoned, NodeName, ExtraProperties, ConcurrencyStamp, CreationTime, CreatorId, LastModificationTime, LastModifierId) VALUES ('3a11f3bd-3967-4b4f-c7c1-d46a35e71c43', NULL, '抽取', '抽取', 'ServiceInvocation', 'OK', '{\"service\":\"ERPContract.IBaseDataAppService,JGSoft.SRM41.EDIManagement.Application.Contracts\",\"method\":\"SendFactoryAsync\",\"data\":\"{\n\u0022api-version\u0022:\u00221\u0022\n}\",\"culture\":\"zh-Hans\",\"tenant\":\"\",\"provider\":\"http\",\"appId\":\"\"}', 10, 1, NULL, 0, '2024-04-14 00:00:00.000000', '2024-04-21 23:59:59.000000', '2024-04-16 10:05:20.764926', NULL, 1, '0 0/10 * ?', 0, 15, 19, 0, 0, 0, 0, 0, NULL, '{}', 'b8c8f154515b43789a890c12572120a5', '2024-04-15 19:41:59.530836', '3a11c3a7-f7cb-b082-ceb1-e4f6e7ae8f88', '2024-04-16 10:05:21.031655', NULL);

我对应的服务: image

在执行到 image

错误消息: Late bound operations cannot be performed on types or methods for which ContainsGenericParameters is true. Parameters: refire = False, unscheduleFiringTrigger = False, unscheduleAllTriggers = False Quartz.JobExecutionException: Job threw an unhandled exception. ---> Quartz.SchedulerException: Job threw an unhandled exception. ---> System.InvalidOperationException: Late bound operations cannot be performed on types or methods for which ContainsGenericParameters is true. at System.Reflection.RuntimeMethodInfo.ThrowNoInvokeException() at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at JGSoft.Abp.BackgroundTasks.Jobs.ServiceInvocationJob.ExecuteWithHttpProxy(JobRunnableContext context, Type serviceType, MethodInfo serviceMethod) in D:\jgsoft.srm.v4.1\aspnet-core\modules\task-management\JGSoft.Abp.BackgroundTasks.Jobs\JGSoft\Abp\BackgroundTasks\Jobs\ServiceInvocationJob.cs:line 159 at JGSoft.Abp.BackgroundTasks.Jobs.ServiceInvocationJob.ExecuteAsync(JobRunnableContext context) in D:\jgsoft.srm.v4.1\aspnet-core\modules\task-management\JGSoft.Abp.BackgroundTasks.Jobs\JGSoft\Abp\BackgroundTasks\Jobs\ServiceInvocationJob.cs:line 95 at JGSoft.Abp.BackgroundTasks.JobRunnableExecuter.InternalExecuteAsync(JobRunnableContext context) in D:\jgsoft.srm.v4.1\aspnet-core\modules\task-management\JGSoft.Abp.BackgroundTasks\JGSoft\Abp\BackgroundTasks\JobRunnableExecuter.cs:line 32 at JGSoft.Abp.BackgroundTasks.JobRunnableExecuter.ExecuteAsync(JobRunnableContext context) in D:\jgsoft.srm.v4.1\aspnet-core\modules\task-management\JGSoft.Abp.BackgroundTasks\JGSoft\Abp\BackgroundTasks\JobRunnableExecuter.cs:line 21 at JGSoft.Abp.BackgroundTasks.Quartz.QuartzJobSimpleAdapter`1.Execute(IJobExecutionContext context) in D:\jgsoft.srm.v4.1\aspnet-core\modules\task-management\JGSoft.Abp.BackgroundTasks.Quartz\JGSoft\Abp\BackgroundTasks\Quartz\QuartzJobSimpleAdapter.cs:line 32 at Quartz.Core.JobRunSh

1、分析了 一下:服务没有包裹 2、在.NET Core中,如果一个类型或方法包含未指定的泛型参数(即ContainsGenericParameters属性为true),则不能进行晚期绑定操作。 我们我们的也是 // 反射所必须的参数 var clientProxyType = typeof(DynamicHttpProxyInterceptorClientProxy<>).MakeGenericType(serviceType);

但是: ///

/// 无返回参数的构建 /// protected readonly static MethodInfo ClientProxyMethod = typeof(DynamicHttpProxyInterceptorClientProxy<>) .GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance) .First(m => m.Name == CallRequestMethod && !m.IsGenericMethodDefinition);

// 直接调用 // object taskProxy = null; var taskProxy = (Task)ClientProxyMethod.Invoke(clientProxy, new object[] { clientProxyRequestContext }); await taskProxy; 然后我们这里的调用直接用的 【ClientProxyMethod】

望指教一下

colinin commented 2 months ago

服务间调用只适用于已注册动态/静态代理接口,没有必要再运行时手动生成代理,在 #938 中已修复

lszai90 commented 2 months ago

tks,你好我还在想问一下我们CAP 里面得Oracle 包 有没

At 2024-04-23 18:09:40, "yx lin" @.***> wrote:

Closed #935 as completed via #938.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>