Link to home
Start Free TrialLog in
Avatar of Iaskyou
Iaskyou

asked on

a question about SendRequest Function of InternetSession class

   I write a ATL Service program using VC 6.0, and some problems happened are very strange.
    This program connect a website page in Internet. by post method using the SendRequest function of InternetSession class. All the connecting codes are writed in a function called "SendOrder" in a dll file, and the Service program use the function of this dll. The "SendOrder" will be run every  time pre minute in the service program. The operation system is WIn2000 professional. My computer connect Internet through the WinGate proxy Server in another computer.
   When I run this service program from the WIndows Service Manager, The first three time connections are successful, but from the fouth connection, the "SendOrder" function will be broken and every code after the SendRequest will no longer run. I don't know what cause this program?
  But if I run the Service program  directly by clicking the exe file, all the connections will ok.
  who can help me?
Avatar of Roshan Davis
Roshan Davis
Flag of United States of America image

Are u calling Close() after each session (pHTTPFile->Close()) ?
Rosh :)
Avatar of Iaskyou
Iaskyou

ASKER

yes, I have close the session.
In addition, I correct some errors in my words.
The first three time connections are failed, but I get catch exception from the SendRequest calling. However,   from the fouth connection, it seems that the SendRequest return nothing everycode after SendRequest does not run before the "SendOrder" function of dll is finished.
Can u show some code
Avatar of Iaskyou

ASKER

I know the reason. When I run the service program from the Service Manager, The authority of user is "LocalSystem". But when I run the service exe file directly, the authority of user is the login administrator. So when the service is run from Service Manager, the SendRequest method failed. But How can I set the authority of the service program by code?
ASKER CERTIFIED SOLUTION
Avatar of Roshan Davis
Roshan Davis
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
"HOWTO: Program a Secure Server on Microsoft Windows NT" please check this on MSDN.