无法跨 AppDomain 传递 GCHandle
我使用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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个已知问题对于 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.