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

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

'unchecked' cannot be called on the client.

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

error

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

error2

    可以看到,第一行声明了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

error3

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

 

posted @ 2015-07-08 16:02  Reinhard_Hsu  阅读(424)  评论(0编辑  收藏  举报