有一个Custom Service一直在正常使用。今天,Reinhard尝试在JOB中以X++代码Debug Custom Service的Method时,收到以下错误提示:

'unchecked' cannot be called on the client.

堆栈跟踪:不能对客户端调用"unchecked"。

Dynamics AX 2012 R2 堆栈跟踪:不能对客户端调用'unchecked'

    从错误提醒中,可以看到在 Custom Service的Method的 line 1处报错。我们进入到该方法中,来看看第一行写的是什么。

Dynamics AX 2012 R2 堆栈跟踪:不能对客户端调用'unchecked'

    可以看到,第一行声明了SysEntryPointAttribute,该属性用于将Method作为WCF的Service Operation Contract曝露。参考 axbytes 的博文 Error when debugging Services class method from X++,通过将第一行声明注释掉,就可以在job中调用了。

    报错的原因,是因为Reinhard将Custom Service Class属性中的Run on设为了Called from。在JOB中以X++代码调用该Method时,导致它Run on Client,从而报错。

    带有SysEntryPointAttribute的Method,只能设为Run on Server

Dynamics AX 2012 R2 堆栈跟踪:不能对客户端调用'unchecked'

    将Custom Service Class属性的Run on设为Server后,就可以从JOB中以X++代码来调试Class中的Method了。

 

相关文章:

  • 2021-10-21
  • 2021-11-07
  • 2021-09-29
  • 2021-05-19
  • 2021-09-09
  • 2021-12-05
  • 2022-01-15
  • 2021-09-11
猜你喜欢
  • 2021-09-06
  • 2021-09-28
  • 2021-05-15
  • 2022-02-01
  • 2021-08-04
  • 2021-08-12
相关资源
相似解决方案