Board index » delphi » COM Object inside a NT Service not working?

COM Object inside a NT Service not working?

I've created a service and a comobject inside it.

I can access the COM object once the service is running but
after about 15 seconds I get the COM message "There are still Active COM
Objects ........." the service is killing the instance for some reason.  The
service still runs but it won't hold a client connection for more then 15
seconds.  It appears a Service is handling COM different then a normal
WinApp.

Thanks for any help.
Steve

 

Re:COM Object inside a NT Service not working?


Have you called CoInitialize(nil) before calling making any COM calls?  TServiceApplication.Initialize doesn't start COM like the normal TApplication.Initialize does.
You may also need to make the service multithreaded, with the COM object instantiated in a "worker" thread separate from the main service thread, which needs to be free to handle messages from the Service Control Manager.

Morgan

Quote
"Stevest" <stev...@Csi.com> wrote:
>I've created a service and a comobject inside it.

>I can access the COM object once the service is running but
>after about 15 seconds I get the COM message "There are still Active COM
>Objects ........." the service is killing the instance for some reason.  The
>service still runs but it won't hold a client connection for more then 15
>seconds.  It appears a Service is handling COM different then a normal
>WinApp.

>Thanks for any help.

>Steve

Re:COM Object inside a NT Service not working?


This means that your application is not correctly installed as a
COM-Service. There's a simple download on my site who's readme explains how
to install a service application as a COM server. (you're just missing the
AppID\LocalService part)

have fun
--
Binh Ly
http://www.techvanguards.com

Quote
"Stevest" <stev...@Csi.com> wrote in message

news:8n9hor$cih1@bornews.borland.com...
Quote
> I've created a service and a comobject inside it.

> I can access the COM object once the service is running but
> after about 15 seconds I get the COM message "There are still Active COM
> Objects ........." the service is killing the instance for some reason.
The
> service still runs but it won't hold a client connection for more then 15
> seconds.  It appears a Service is handling COM different then a normal
> WinApp.

> Thanks for any help.

> Steve

Re:COM Object inside a NT Service not working?


Hi!

Quote
>I can access the COM object once the service is running but
>after about 15 seconds I get the COM message "There are still Active COM
>Objects ........." the service is killing the instance for some reason.
The
>service still runs but it won't hold a client connection for more then 15
>seconds.  It appears a Service is handling COM different then a normal
>WinApp.

It is not so easy to create really working COM server in service (I do not
mean simple example a-la "Hello, World"). I would recommend you to visit my
site and read about the problem. If you need a ready-to-use solution I could
suggest my SvCom library.
It is available at http://www.aldyn.ru/products/svcom/

Alexey Dynnikov <al...@aldyn.ru>
http://www.aldyn.ru/
SvCom - The Joy of Services

Re:COM Object inside a NT Service not working?


Following this thread, I turned one of my current applications into a service,
as it was required by one of our clients.  I've managed to get everything
working including doing some of the work with the service through a vb com
object!  However, I've still got one minor/major problem.  I develop on Win2000
professional and I need the application to run on the server Win2k Advanced
server.  I've managed to get it running correctly on my own machine and another
workstation (also win2k prof) and connect to the server and do its stuff.
However when I try and register the service on the server, it refuses, it looks
like its registering, but then nothing happens, it doesnt appear in my list of
services.

Any suggestions?

Toby Allen.

Quote
Binh Ly wrote:
> This means that your application is not correctly installed as a
> COM-Service. There's a simple download on my site who's readme explains how
> to install a service application as a COM server. (you're just missing the
> AppID\LocalService part)

> have fun
> --
> Binh Ly
> http://www.techvanguards.com

> "Stevest" <stev...@Csi.com> wrote in message
> news:8n9hor$cih1@bornews.borland.com...
> > I've created a service and a comobject inside it.

> > I can access the COM object once the service is running but
> > after about 15 seconds I get the COM message "There are still Active COM
> > Objects ........." the service is killing the instance for some reason.
> The
> > service still runs but it won't hold a client connection for more then 15
> > seconds.  It appears a Service is handling COM different then a normal
> > WinApp.

> > Thanks for any help.

> > Steve

Other Threads