无法跨 AppDomain 传递 GCHandle

发布于 2024-09-08 05:44:05 字数 1539 浏览 7 评论 0原文

我使用asp.net 和C# 实现了quickfix 引擎。 我正在调用quickfix_net.dll,它是用非托管C++编写的。 但在调用quickfix_net.dll 时出现“无法跨AppDomains 传递GCHandle”之类的错误。

但同样的事情在控制台应用程序中运行,但不在 IIS 下运行,即 asp.net

请任何人调查此事。 提前致谢

以下是我的代码:

SessionSettings settings = new SessionSettings(tradeClientPath);

ApplicationMessage application = new ApplicationMessage();
FileStoreFactory storeFactory = new FileStoreFactory(settings);
FileLogFactory logFactory = new FileLogFactory(settings);
MessageFactory messageFactory = new DefaultMessageFactory();

SocketInitiator initiator = new SocketInitiator
  (application, storeFactory, settings, logFactory, messageFactory);
initiator.start();

Message message = new Message();

OrdType ordType = new OrdType(OrdType.MARKET);

QuickFix42.NewOrderSingle newOrderSingle = new QuickFix42.NewOrderSingle(new ClOrdID("1"), new HandlInst('1'), new Symbol("WAKEN\00110048=2")
                  , new Side(Side.BUY), new TransactTime(), new OrdType(OrdType.MARKET));

newOrderSingle.set(new OrderQty(10));
newOrderSingle.set(new TimeInForce(TimeInForce.DAY));

Message.Header header = newOrderSingle.getHeader();
header.setField(new SenderCompID("CLIENT1"));
header.setField(new TargetCompID("EXECUTOR"));

message = newOrderSingle;

**QuickFix.Session.sendToTarget(message);** // here i am getting exception

initiator.stop();

网站参考是: http://www .quickfixengine.org/quickfix/doc/html/index.html

I have implemented quickfix engine using asp.net and C#.
and i am calling quickfix_net.dll which is written in unmanaged C++.
but i am getting error like "Cannot pass a GCHandle across AppDomains" when calling quickfix_net.dll.

but the same thing is running in console application but not under IIS i.e asp.net

please anybody look into matter.
thanks in advance

Following are my code:

SessionSettings settings = new SessionSettings(tradeClientPath);

ApplicationMessage application = new ApplicationMessage();
FileStoreFactory storeFactory = new FileStoreFactory(settings);
FileLogFactory logFactory = new FileLogFactory(settings);
MessageFactory messageFactory = new DefaultMessageFactory();

SocketInitiator initiator = new SocketInitiator
  (application, storeFactory, settings, logFactory, messageFactory);
initiator.start();

Message message = new Message();

OrdType ordType = new OrdType(OrdType.MARKET);

QuickFix42.NewOrderSingle newOrderSingle = new QuickFix42.NewOrderSingle(new ClOrdID("1"), new HandlInst('1'), new Symbol("WAKEN\00110048=2")
                  , new Side(Side.BUY), new TransactTime(), new OrdType(OrdType.MARKET));

newOrderSingle.set(new OrderQty(10));
newOrderSingle.set(new TimeInForce(TimeInForce.DAY));

Message.Header header = newOrderSingle.getHeader();
header.setField(new SenderCompID("CLIENT1"));
header.setField(new TargetCompID("EXECUTOR"));

message = newOrderSingle;

**QuickFix.Session.sendToTarget(message);** // here i am getting exception

initiator.stop();

Web site reference is : http://www.quickfixengine.org/quickfix/doc/html/index.html

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱*していゐ 2024-09-15 05:44:05

这是一个已知问题对于 QuickFix.Net,它只能在进程内工作。所以基本上没有太多选择,除了改变FIX插件。

It's a known issue with QuickFix.Net, it only works in-proc. So basically there are not many options, short of changing FIX plugin.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文