Trying to register a Windows Service gives error

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Trying to register a Windows Service gives error

Graeme Geldenhuys-7
Hi,

I created a relatively simple Windows Service Application using FPC
2.6.4. The application imports CSV data from a monitored folder and
updates product tables in a MS SQL Server database.

The Service Application installed and ran perfectly on my Windows 7
workstation. It also installed and ran perfectly on our Development
Server (Windows 2008 R2 SP1 64-bit).

But when we deployed the application to our client's test server (also
Windows 2008 R2 SP1 64-bit) we got the following error trying to
register the service.

==============================================
C:\Q-Point\csvimporter>csvimporter_service
Usage: C:\Q-Point\csvimporter\csvimporter_service.exe [command]
Where command is one of the following:
  -i --install   To install the program as a service
  -u --uninstall To uninstall the service
  -r --run       To run the service

C:\Q-Point\csvimporter>csvimporter_service -i
exception at 0042CD50:
System error, (OS Code 5):
Access is denied.
.

C:\Q-Point\csvimporter>
==============================================

Immediately I thought we don't have enough permissions on the client
test server. The client came back and said the user we are using is an
Administrator user. So permissions shouldn't be a problem. :-/

Any thoughts on what it could be?


More details on the application:
--------------------------------
The application is based on the daemonapp.pp unit - part of FCL-Extra.
I've followed Michael van Canneyts "daemon.pdf" article to the letter. I
created the application, created the daemon thread etc. As I mentioned,
it works fine on my workstation and on our development test server. But
doesn't install on the client's test server.


I Googled the error and came across a FPC-Pascal message from 2011.
[http://lists.freepascal.org/pipermail/fpc-pascal/2011-October/030464.html].
But in that discussion the developer tried to query the Windows Services
by instantiating a TServiceManager instance. In our case we are using
the daemonapp unit instead.

Any help would be greatly appreciated.

Regards,
  Graeme




This email and its attachments may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions are solely those of the author and do not necessarily represent those of Quality Technology Systems Ltd. If you are not the intended recipient of this email and its attachments, you must take no action based upon them, nor must you copy or show them to anyone. If you receive the message in error, please immediately delete it, destroy all copies of it and notify the sender. Internet email is not a totally secure medium and therefore Quality Technology Systems Ltd does not accept legal responsibility for the contents of this message. We have taken steps to ensure that this email and any attachments are free from viruses. However, we cannot accept any responsibility for any virus transmitted by us and recommend that you subject any incoming email to your own virus checking procedure. Registered in England No. 3208823
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Trying to register a Windows Service gives error

Graeme Geldenhuys-7

On 06/10/2014 11:59, Graeme Geldenhuys wrote:

> C:\Q-Point\csvimporter>csvimporter_service -i
> exception at 0042CD50:
> System error, (OS Code 5):
> Access is denied.


Just a quick follow-up...

I eventually found the problem (by pure luck). Windows Server is weird!
Even though we logged in with an Administrator privileged account, when
you open the standard Command Prompt window, it is NOT admin privileged.
Thus the error. We had to right click the Command Prompt shortcut and
select "Run as Administrator" - then the service registered and ran fine.

Regards,
  Graeme


This email and its attachments may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions are solely those of the author and do not necessarily represent those of Quality Technology Systems Ltd. If you are not the intended recipient of this email and its attachments, you must take no action based upon them, nor must you copy or show them to anyone. If you receive the message in error, please immediately delete it, destroy all copies of it and notify the sender. Internet email is not a totally secure medium and therefore Quality Technology Systems Ltd does not accept legal responsibility for the contents of this message. We have taken steps to ensure that this email and any attachments are free from viruses. However, we cannot accept any responsibility for any virus transmitted by us and recommend that you subject any incoming email to your own virus checking procedure. Registered in England No. 3208823
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Trying to register a Windows Service gives error

Sven Barth-2

Am 06.10.2014 17:19 schrieb "Graeme Geldenhuys" <[hidden email]>:
>
>
> On 06/10/2014 11:59, Graeme Geldenhuys wrote:
>
> > C:\Q-Point\csvimporter>csvimporter_service -i
> > exception at 0042CD50:
> > System error, (OS Code 5):
> > Access is denied.
>
>
> Just a quick follow-up...
>
> I eventually found the problem (by pure luck). Windows Server is weird!
> Even though we logged in with an Administrator privileged account, when
> you open the standard Command Prompt window, it is NOT admin privileged.
> Thus the error. We had to right click the Command Prompt shortcut and
> select "Run as Administrator" - then the service registered and ran fine.

That's the case since Windows Vista. Maybe you have disabled UAC or any involved mechanisms on the development machines?

Regards,
Sven


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Trying to register a Windows Service gives error

Graeme Geldenhuys-7


On 06/10/2014 16:36, Sven Barth wrote:
> That's the case since Windows Vista. Maybe you have disabled UAC

Interesting, thanks for mentioning that. I know I've disabled UAC on my
work laptop. I'm not in control of our development server, but I'll ask
the admin when he is back in the office.


Regards,
  Graeme


This email and its attachments may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions are solely those of the author and do not necessarily represent those of Quality Technology Systems Ltd. If you are not the intended recipient of this email and its attachments, you must take no action based upon them, nor must you copy or show them to anyone. If you receive the message in error, please immediately delete it, destroy all copies of it and notify the sender. Internet email is not a totally secure medium and therefore Quality Technology Systems Ltd does not accept legal responsibility for the contents of this message. We have taken steps to ensure that this email and any attachments are free from viruses. However, we cannot accept any responsibility for any virus transmitted by us and recommend that you subject any incoming email to your own virus checking procedure. Registered in England No. 3208823
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Trying to register a Windows Service gives error

Sven Barth-2

Am 06.10.2014 17:45 schrieb "Graeme Geldenhuys" <[hidden email]>:
>
>
>
> On 06/10/2014 16:36, Sven Barth wrote:
> > That's the case since Windows Vista. Maybe you have disabled UAC
>
> Interesting, thanks for mentioning that. I know I've disabled UAC on my
> work laptop. I'm not in control of our development server, but I'll ask
> the admin when he is back in the office.

It's one of the reasons why I keep UAC enabled on my Windows systems: I catch such problems immediately ;)

Regards,
Sven


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Trying to register a Windows Service gives error

Michael Van Canneyt


On Mon, 6 Oct 2014, Sven Barth wrote:

>
> Am 06.10.2014 17:45 schrieb "Graeme Geldenhuys" <[hidden email]>:
> >
> >
> >
> > On 06/10/2014 16:36, Sven Barth wrote:
> > > That's the case since Windows Vista. Maybe you have disabled UAC
> >
> > Interesting, thanks for mentioning that. I know I've disabled UAC on my
> > work laptop. I'm not in control of our development server, but I'll ask
> > the admin when he is back in the office.
>
> It's one of the reasons why I keep UAC enabled on my Windows systems: I catch such problems immediately ;)

I stopped doing that, because the constant messages are a real PITA.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Trying to register a Windows Service gives error

Sven Barth-2

Am 07.10.2014 09:55 schrieb "Michael Van Canneyt" <[hidden email]>:
>
>
>
> On Mon, 6 Oct 2014, Sven Barth wrote:
>
>>
>> Am 06.10.2014 17:45 schrieb "Graeme Geldenhuys" <[hidden email]>:
>> >
>> >
>> >
>> > On 06/10/2014 16:36, Sven Barth wrote:
>> > > That's the case since Windows Vista. Maybe you have disabled UAC
>> >
>> > Interesting, thanks for mentioning that. I know I've disabled UAC on my
>> > work laptop. I'm not in control of our development server, but I'll ask
>> > the admin when he is back in the office.
>>
>> It's one of the reasons why I keep UAC enabled on my Windows systems: I catch such problems immediately ;)
>
>
> I stopped doing that, because the constant messages are a real PITA.

Our main application requires admin rights as well, but quite quickly my muscle memory has taken over so that I can just dismiss the UAC dialog without thinking much about it. (I did disable the "use secure desktop" option though so that I don't get a black screen for some seconds...)

Regards,
Sven


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Trying to register a Windows Service gives error

Michael Schnell
In reply to this post by Graeme Geldenhuys-7
On 10/06/2014 05:12 PM, Graeme Geldenhuys wrote:
...
Please don't use such excessive multi-line "declaimers" in a forum.

-Michael
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Trying to register a Windows Service gives error

Graeme Geldenhuys-7
Hi Michael,

On 07/10/2014 12:12, Michael Schnell wrote:
> Please don't use such excessive multi-line "declaimers" in a forum.

I did notice those (and don't like it either), but unfortunately nothing
I can do about it. It is my work address and our mail server injects
those "disclaimers" _after_ we sent the messages from our computers.

I'll try and limit posts from my work address to this mailing list.

Regards,
  Graeme


This email and its attachments may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions are solely those of the author and do not necessarily represent those of Quality Technology Systems Ltd. If you are not the intended recipient of this email and its attachments, you must take no action based upon them, nor must you copy or show them to anyone. If you receive the message in error, please immediately delete it, destroy all copies of it and notify the sender. Internet email is not a totally secure medium and therefore Quality Technology Systems Ltd does not accept legal responsibility for the contents of this message. We have taken steps to ensure that this email and any attachments are free from viruses. However, we cannot accept any responsibility for any virus transmitted by us and recommend that you subject any incoming email to your own virus checking procedure. Registered in England No. 3208823
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Trying to register a Windows Service gives error

Giuliano Colla

Il 07/10/2014 13:31, Graeme Geldenhuys ha scritto:
> Hi Michael,
>
> On 07/10/2014 12:12, Michael Schnell wrote:
>> Please don't use such excessive multi-line "declaimers" in a forum.
> I did notice those (and don't like it either), but unfortunately nothing
> I can do about it. It is my work address and our mail server injects
> those "disclaimers" _after_ we sent the messages from our computers.

It's the way lawyers try to appear indispensable: annoying everybody
with useless lengthy legal stuff. Decent people, when receiving an
e-mail not meant for them, just trash it. Marauders will try to take
advantage from it, no matter how long is the disclaimer.

Giuliano

--
Giuliano Colla

Project planning question: when it's 90% done, are we halfway or not yet?

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal