Click here to Skip to main content
15,891,423 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have developed the windows service in C#.NET.
in this service i have used the Onshutdown() event to do some task at the time of system shutdown .in this fuction i have write insert the data in mysql table . but when this fuction excuted the mysql service already stop so it can't connect to the mysql . used the following fuction :
C#
protected override void OnShutdown()
 {
   base.OnShutdown();
//insert data in mysql table
    }



how to stop the mysql sevice after my service task finished ?
Posted

1 solution

To solve you problem, you can use message Queue service. While shutting down, add a queue in the Message Queue with all details. and when windows service start check for the Queues in the Message Queue and insert the same data in the database.

If you don't want to use the Message Queue, then we can use File System. Store your data into a file.
I think this will help you.
 
Share this answer
 
Comments
vrushali katkade 7-Feb-12 4:15am    
but i want to access this data later from the mysql table

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900