Hi all, I've developed an application connecting to Interactive Brokers via IB Gateway. It words fine on my local machine, but on the server it crashes as soon as I make any call to any TWS function, like connect etc. Interestingly, I can connect using Matlab without problem on the server, how can this be? This must mean the problem lies in the C# executable, or? Here are the configurations: Local machine: Windows 8.1 Visual Studio 2015 TWS v950.2g Java 64 bit version Server: Windows Server 2012 Java 32 bit version 1.8.0_31 TWS 948.3c Executable is 32 bit. Have tried generating a 64-bit version as well but same result. Also tried to register the Tws.ocx using regsvr32 from the SysWOW folder on the server, still no success. I thought there shouldn't be an issue if both the TWS OCX and the executable have are of same bit type? Thanks in advance.
I think you just should trace your program inside the debugger and find the first location where an error happens. I guess the initialization fails, but it seems there is no evaluation of the return code (or exception catching) of that in your code. Sorry, can't help any further as I've moved to Linux some years ago... ;-)
The first line where it happens is axTws1.connect("", 7496, 16); The crash report doesn't say much either: Problem signature: Problem Event Name: CLR20r3 Problem Signature 01: test2.exe Problem Signature 02: 1.0.0.0 Problem Signature 03: 56cdbd6d Problem Signature 04: Test2 Problem Signature 05: 1.0.0.0 Problem Signature 06: 56cdbd6d Problem Signature 07: 27 Problem Signature 08: 397 Problem Signature 09: System.NullReferenceException OS Version: 6.2.9200.2.0.0.272.7 Locale ID: 2057 Additional Information 1: 5861 Additional Information 2: 5861822e1919d7c014bbb064c64908b2 Additional Information 3: dac6 Additional Information 4: dac6c2650fa14dd558bd9f448e23afd1
I think in recent versions they have changed the port number to 7497 ;-) Just try it. Update: "note: The default port for gateway is 4001, TWS is 7496 or maybe 7497 for paper trading."
Error report mentions signature issue; function connect has different signatures depending on API version; there is an extra bool parameter at the end in most recent versions. .Net does not produce stand alone executables. It still needs proper framework version that your application targets. On top of that IB API may require additional components to run like C++ 2005 runtime and also old Visual J if I am not mistaken; check IB references for exact requirements. I would start with checking your environment and fixing it if needed.