Home  Search  Register  Login  Recent Posts

Information on DTN's Industries:
DTN Oil & Gas | DTN Trading | DTN Agriculture | DTN Weather
Follow DTNMarkets on Twitter
DTN.IQ/IQFeed on Twitter
DTN News and Analysis on Twitter
»Forums Index »Archive (2017 and earlier) »IQFeed Developer Support »Launching IQConnect from Windows 7 Service requires Administrator account
Author Topic: Launching IQConnect from Windows 7 Service requires Administrator account (7 messages, Page 1 of 1)

FistPeso
-Interested User-
Posts: 15
Joined: Aug 16, 2012


Posted: Aug 16, 2012 01:41 AM          Msg. 1 of 7
I have IQConnect being started from within a Windows 7 Service via the Process.Start() method, which is followed up with a TcpClient connection to 127.0.0.1:5009 to access the Level 1 stream. If I run the Windows Service as the Administrator user account, everything works fine, but if I try to use the LocalSystem, or any other account, including other admin accounts, the TcpClient connect fails with the following message:
"No connection could be made because the target machine actively refused it 127.0.0.1:5009". I tried firewall permission, though I can't imagine that it is causing the issue, and countless security changes trying to unlock this problem. Do you know how I can launch IQConnect without having to run the service with the admin account?

Called from within the Windows Service....
var process = new ProcessStartInfo
{
Verb = "runas",
UseShellExecute = true,
Arguments = string.Format("-product {0} -version {1} -login {2} -password {3} -
autoconnect", _registeredProductName, _productVersion, _loginId, _password),
FileName = ConnectFileName
};
Process.Start(process);

DTN_Steve_S
-DTN Guru-
Posts: 2096
Joined: Nov 21, 2005


Posted: Aug 16, 2012 11:16 AM          Msg. 2 of 7
Generally speaking, IQFeed wasn't designed to be run from a service but I don't really see any reason you would need to run as admin under this scenario.

I am having some problems setting up a project to duplicate this so I can dig into it. Can you send a small test project to dev support that demonstrates what you are seeing?

FistPeso
-Interested User-
Posts: 15
Joined: Aug 16, 2012


Posted: Aug 16, 2012 01:13 PM          Msg. 3 of 7
Sure, I will put something together this evening. Do you have a list of all the security permissions IQConnect requires in the Windows domain? When I login as the Administrator account I can telnet to port 5009 and everything is working great. When I login as LocalSystem or other admin equivalent account, I cannot telnet to the port. The port is not listening, so it appears that IQConnect is wanting to use some system resource that requires a special permission.

Thank you Steve!

DTN_Steve_S
-DTN Guru-
Posts: 2096
Joined: Nov 21, 2005


Posted: Aug 16, 2012 01:45 PM          Msg. 4 of 7
No need for the project just yet. I finally got this working from a windows service but I wasn't able to duplicate your issue (yet). On my machine, IQFeed runs just fine using the LocalSystem user account.

After thinking about it a bit more, if you add the -savelogininfo command line parameter to IQConnect does it work under both accounts?

Without the -savelogininfo parameter, the -autoconnect parameter is ignored.

I believe IQConnect is waiting for you to tell it to connect and then exiting after 30s when it doesn't get that command.

FistPeso
-Interested User-
Posts: 15
Joined: Aug 16, 2012


Posted: Aug 16, 2012 01:56 PM          Msg. 5 of 7
Thanks Steve, I have tried that configuration combo as well and it has not resolved the issue. In addition, I can step through the process in the debugger and I see it immediately failing when trying to connect to the 5009 port, there is no 30 second timeout. Again, the exact same code works fantastic with the Administrator account, so I am thinking that it is not configuration, but more likely rights of some sort.

DTN_Steve_S
-DTN Guru-
Posts: 2096
Joined: Nov 21, 2005


Posted: Aug 16, 2012 02:08 PM          Msg. 6 of 7
Does IQConnect show up in the list of processes (make sure you have task manager show processes for all users) immediately after starting the service (at least for the first 30s)?

Or, if you switch to trying to connect to the Admin port (9300) instead of the Level 1 port (5009), does it connect?

When IQConnect is initially launched, the only listening port that is opened is the Admin port (9300), no other ports open until after authentication. As a result, if IQConnect isn't authenticating then it will run for 30s and then exit since you haven't established a connection to the admin port.

FistPeso
-Interested User-
Posts: 15
Joined: Aug 16, 2012


Posted: Aug 16, 2012 10:49 PM          Msg. 7 of 7
Steve it looks I was able to solve the problem with your help. The issue was defiantly the savelogininfo switch. I know I tried it before, but with all the configuration environment changes something else must have been out of sync. The reason it appeared that it only worked with the Admin account is due to the fact that after I installed the Client/API, I tested the connection and set the autoconnect flags at that time. So when I was launching it from the service it was already flagged for autoconnect. Hopefully this post will help someone else afflicted by this issue and answer the question that your can call your the feed from a Windows 7 service.

I would also like to echo the sentiment of several others, please upgrade IQConnect.exe into an API library that I can call directly without first starting this process. That being said, your support is absolutely wonderful. Thank you!

Final working process call:
var process = new ProcessStartInfo
{
Arguments = string.Format("-product {0} -version {1} -login {2} -password {3}
-autoconnect -savelogininfo", _registeredProductName, _productVersion, _loginId,
_password),
FileName = ConnectFileName
};
Process.Start(process);
 

 

Time: Thu October 31, 2024 6:56 PM CFBB v1.2.0 11 ms.
© AderSoftware 2002-2003