Re: My .NET service dows not stop in a controlled way
- From: "Solje" <stefan.soljemo@xxxxxxxxxxx>
- Date: 26 Mar 2007 13:08:36 -0700
Thank you for answer.
The code in by first post is the only code I have except the project
solution and assembly information file.
You wrote that my process shall exits it self. I canot understand the
different between stop of service from SCM and system shut down from
the
service point of view. How shall my service do exit self, is there
any
methods to use for that purpose. The method must let the garbage
colection do
its work before the process exits.
"Walter Wang [MSFT]" wrote:
Click to show or hide original message or reply text.
Hi Stefan,
Sorry for delayed reply.
I suggest logging the ThreadId using Thread.ManagedThreadId instead of
Thread.GetHashCode since GetHashCode doesn't produce unique code everytime.
Based on my understanding, the OnShutdown is called by ServiceBase using an
asynchronous call. If the service process doesn't exit itself within a
timeout, it will be killed by SCM -- in which case will cause data loss or
unclosed resource. I believe this timeout is specified here:
HKLM\System\CurrentControlSet\Control, the WaitToKillServiceTimeout value.
What's expected time will be required to clean up all your threads and
resources?
#How to Increase Shutdown Time for Services to Close Properly
http://support.microsoft.com/kb/146092
I'm still not quite clear about how your threads are using and closing the
database connections when starting and stopping, would you please post more
code? Thanks.
Sincerely,
Walter Wang (wawang@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
.
- Follow-Ups:
- Re: My .NET service dows not stop in a controlled way
- From: Walter Wang [MSFT]
- Re: My .NET service dows not stop in a controlled way
- References:
- My .NET service dows not stop in a controlled way
- From: Stefan Soljemo
- RE: My .NET service dows not stop in a controlled way
- From: Walter Wang [MSFT]
- My .NET service dows not stop in a controlled way
- Prev by Date: Rich test box in DataGridView Control
- Next by Date: xxxx.dll.config file for what? (Setting for DLL)
- Previous by thread: RE: My .NET service dows not stop in a controlled way
- Next by thread: Re: My .NET service dows not stop in a controlled way
- Index(es):
Relevant Pages
|