我已经看过许多关于异常的帖子"无法通过AppDomains传递GCHandle",但我仍然没有得到它......
我正在使用由DLL驱动的RFID阅读器.我没有此DLL的源代码,只有一个示例来说明如何使用它.
该示例工作得很好,但我必须在另一个项目中复制一些代码,以将读取器添加到中间件Microsoft Biztalk.
问题是Microsoft Biztalk的进程在另一个AppDomain中工作.阅读器在读取标签时处理事件.但是当我在Microsoft Biztalk下运行它时,我遇到了这个令人烦恼的异常.
我看不出任何有关如何使其工作的解决方案......
以下是一些可能有趣的代码:
// Let's connecting the result handlers.
// The reader calls a command-specific result handler if a command is done and the answer is ready to send.
// So let's tell the reader which functions should be called if a result is ready to send.
// result handler for reading EPCs synchronous
Reader.KSRWSetResultHandlerSyncGetEPCs(ResultHandlerSyncGetEPCs);
[...]
var readerErrorCode = Reader.KSRWSyncGetEPCs();
if (readerErrorCode == tKSRWReaderErrorCode.KSRW_REC_NoError)
{
// No error occurs while sending the command to …Run Code Online (Sandbox Code Playgroud)