I wanted to create simple service, which would periodically download a list of e-mail adresses and send them e-mails.
I started writing the service, and before that I tested, if the e-mail sending works - and yes, it does.
The problem is, that whereas I get no timeouts while sending e-mails by simply using the mailing method in Main() I get the timeouts and exceptions, when I try to do the same while executing the code as a service (using InstallUtil.exe, then going to My computer/manage and starting the service)
I guess it has to be some permissions/privileges issue, but have completely no idea, how to solve it - I tried to turn the firewalls off with no effect. When I call the mailing method in onStart(), onStop() methods or in the thread that the service starts - I'm unable to "connect to remote server". I tried using different ports and SMTP servers, but it's all the same - it works as long as I run the code in a non-service program. I tried different service settings - LocalSystem, NetworkService itp - all the same.
The same goes with any changes to the Windows Registry - I can do the reading/writing while the Main() is being executed or even in the service installer - but it doesn't work when the service wants to use it.
Please help!