Windows NT Service 
Author Message
 Windows NT Service

Hi,

I have written a Windows NT Service using VC++.

Requirements:

1. Should work against Exchange Server (but can be installed on any Windows
NT server)
2. Should poll for incoming messages on a particular mailbox
3. Should be multithreaded (to handle multiple messages)
4. Process the message

Scenario:

1. All the above requirements are satisfied.

But....

1. The load on the exchange isi high because we are polling for incoming
messages in a loop. (BTW we are using CDO to do this)
2. The service works fine in my development environment, but when I take it
to a production server, it fails every 15 minutes.

Observation:

1. In the event viewer, I could see that just before the service fails, the
IIS performance counters would have kicked in.

Help required:

1. If my logic of developing the service is incorrect, would like to know
about a better logic.
2. Also would like to know why my service keeps failing intermittently.

Please respond with answers and any further questions you might have to help
me resolve this issure.

Thanks,



Mon, 03 Feb 2003 03:00:00 GMT  
 Windows NT Service
In the loop, try placing a Sleep(1000) at the end of every iteration.
Most likely your service is starving the CPU. You can adjust the length
of the Sleep to get different behaviors.
--
Randy Charles Morin [MVP] - http://www.kbcafe.com/
Author of "Programming Windows Services"
http://www.kbcafe.com/047138576X



Quote:
> Hi,

> I have written a Windows NT Service using VC++.

> Requirements:

> 1. Should work against Exchange Server (but can be installed on any
Windows
> NT server)
> 2. Should poll for incoming messages on a particular mailbox
> 3. Should be multithreaded (to handle multiple messages)
> 4. Process the message

> Scenario:

> 1. All the above requirements are satisfied.

> But....

> 1. The load on the exchange isi high because we are polling for
incoming
> messages in a loop. (BTW we are using CDO to do this)
> 2. The service works fine in my development environment, but when I
take it
> to a production server, it fails every 15 minutes.

> Observation:

> 1. In the event viewer, I could see that just before the service
fails, the
> IIS performance counters would have kicked in.

> Help required:

> 1. If my logic of developing the service is incorrect, would like to
know
> about a better logic.
> 2. Also would like to know why my service keeps failing
intermittently.

> Please respond with answers and any further questions you might have
to help
> me resolve this issure.

> Thanks,

Sent via Deja.com http://www.deja.com/
Before you buy.


Tue, 04 Feb 2003 03:00:00 GMT  
 Windows NT Service
Hi,

One thing you may want to know. If a service create a child process or
thread the thread or process will not be running in the same context. So
don't fall into the same trap I did and write the service which worked fine
during the whole of testing and then when the security is placed onto the
environment your code stops working over night. It is only the service exe
that runs in the context of a system process.

As the Cpu hogging do what the other chap says and place a sleep call in. To
make the service more flexible and faster when you buy new hardware place a
call to read the time out interval from the registry!

Cheers


Quote:
> Hi,

> I have written a Windows NT Service using VC++.

> Requirements:

> 1. Should work against Exchange Server (but can be installed on any
Windows
> NT server)
> 2. Should poll for incoming messages on a particular mailbox
> 3. Should be multithreaded (to handle multiple messages)
> 4. Process the message

> Scenario:

> 1. All the above requirements are satisfied.

> But....

> 1. The load on the exchange isi high because we are polling for incoming
> messages in a loop. (BTW we are using CDO to do this)
> 2. The service works fine in my development environment, but when I take
it
> to a production server, it fails every 15 minutes.

> Observation:

> 1. In the event viewer, I could see that just before the service fails,
the
> IIS performance counters would have kicked in.

> Help required:

> 1. If my logic of developing the service is incorrect, would like to know
> about a better logic.
> 2. Also would like to know why my service keeps failing intermittently.

> Please respond with answers and any further questions you might have to
help
> me resolve this issure.

> Thanks,



Sat, 08 Feb 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. MAPI_E_LOGON_FAILED from a Windows NT Service

2. How to debug windows nt services

3. Windows NT Service Pack 4 Debug Symbols

4. Debugging a Windows NT Service

5. Windows NT Services...

6. Windows NT Service Programs...

7. Debugging a Windows NT Service

8. Sockets in a Windows NT Service

9. Windows NT Services and Memory Leaks

10. Q: Windows NT Service

11. Running a Windows NT service

12. Determining Which Windows NT Service is running from inside the code

 

 
Powered by phpBB® Forum Software