本文介绍了在AIF服务中无法捕获异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在动态AX 2012中创建了一个AIF服务,当我通过调用工作中的entrypoint方法来测试它时,它工作正常,但是当部署调用来自soap UI时,它会在内部崩溃一个错误:未处理的设置。



在调试时,我发现未处理的异常抛出在我的catch语句的catch子句中。



它内部的catch,因为我在try子句内调用的方法有一个错误。



有谁知道为什么我可以抓住抛出错误,当我在客户端使用这个工作运行代码,但是无法抓住它,而它运行在服务器上的CIL,该服务是从SoapUi调用的?

解决方案

解决,



AIF在核心代码深处有一个大事务,自己尝试catch。



所以当你在AIF服务器中引发错误时,它会中止外部事务,并且直到AIF catch子句,跳过所有其他的。 p>

这就是为什么我抓不到它。解决方案可能是提交AIF事务,运行代码,然后返回开始新的事务。


I have created an AIF service in dynamics AX 2012, when I tested it by calling the entrypoint method from a job, it worked fine, but when it is deployed en the calls are comming from the soap UI, it crashes inside with an error: "Unhandled esception".

While debugging I found out the unhandled exception is thrown inside my catch clause of my try catch statement.

It gets inside the catch because the method I am calling inside the try clause thows an error.

So does anyone know why I can catch thrown error when I am running the code on client using the job, but can't catch it while it runs in CIL on the server and the service is called from SoapUi?

解决方案

Solved,

AIF has one big transaction somewhere deep in the core code and an own try catch.

So when you throw an error inside AIF sevice it is going to abort the outer transaction and go to staight to the AIF catch clause, skipping all others.

That's why I couldn't catch it. Solution could be to commit AIF transaction, run your code and before return begin new transaction.

这篇关于在AIF服务中无法捕获异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 03:08