Solved

Service Application

Posted on 2004-08-04
9
168 Views
Last Modified: 2010-04-05
I have created a Service Application that will call an executable inside a timer event.
My problem is that when the timer fires, the function to open the executable is made but the exe doesnt open.
When I try this on three other PC's all of different Operating Systems the Service works OK.
I know my problem is due to security on the offending PC but how and where do you look to configure security options to allow a Service access?

The PC that the Service doesnt work on is a Windows Server 2003. However I have tested the service on another Server 2003 PC and XP and 2000 and all work OK so it is the first Window Server 2003 that is the problem.

I know the code works as I have taken the Service code and placed it into a regular windows application and using a button click executed the code. And the program works.

Any help would be appreciated,
Thanks
0
Comment
Question by:HotRod40
  • 3
  • 2
9 Comments
 
LVL 17

Accepted Solution

by:
TheRealLoki earned 125 total points
ID: 11719828
I'm at a loss to know why it would work on 1 windows 2003 server, and not another.
I assume you are logging the service on as local system - interactive?
If so, and your service does not really have any visual aspecty, you might like to try the following
set up a user specifically for the service, and put it in an appropriate group to have the permissions you need.
For a "test" you could try logging your service on as an administrator. (property on the service settings)
If that works, then either
a) leave it like that
b) find out what policy / user rights settings differ between the 2 server 2003's
c) make a new user specifically for your service

What I tend to do is make a new group with nearly the same access as administrator, but the inability to logon as a user, i then make a user for that group, and tell my service to log on as that user
e.g. MyServiceGroup  - MyServiceUser

If, on the other hand, you can query the security policy settings, and user rights and see the difference between the 2 server 2003's then you wont have to do this.

hth, Loki
0
 
LVL 3

Expert Comment

by:MikProg
ID: 11723220
Any action in windows have result. What error code do you recieve if app does not started?
0
 

Author Comment

by:HotRod40
ID: 11723958
Thankyou for your suggestions.

I have tried logging the service on as the admin account but I receive a message showing:

   'MyAdmin has been granted the logon as a Service right'

MyAdmin being an administrator account.  What does this message mean?

In the mean time I will try to setup a specific account for the Service

0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:HotRod40
ID: 11724428
Hi,

I now have my Service login correct by creating a specific account.
My problem now is that this service performs a sql query on a SQL Server database, counts the number of records and writes to a text file.
As my code reaches the open statement of the query, the Service restarts.
Why cant I run this query? I have placed the same code in a regular exe and there is no problem so I believe it is something to do with Services.

Thanks
0
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 11729827
So are you saying that the service is working now, but you have a different problem now?
I mean, does this SQL work in the service on the other server 2003? or is this new?

do  you have a try-except around your code, so you can catch any errors and log them (the event log might be a good place)
A common mistake I make when writing sql is I leave the database component connected at design time, and it then causes an error when I run it (trying to connect when already connected, or can not find the default database, etc)
make sure you have set any connected properties to false before you compile. Aside from that, I'll need a little more information. sSee if you can get an error message
try
...
except on e:exception do
 " save error" E.Message
end;
0
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 13341605
my suggestions appear to have resolved his first issue, but then he has a subsequent sql related issue which I asked for more information, and made some suggestions for. I have not heard back from him about this
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi XE10, MySQL Query 4 164
creating threads in delphi 1 131
Tidtcpserver listening on multiports? 1 35
How to Get Images From Server using App Tethering 11 39
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question