Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / October 2007

Tip: Looking for answers? Try searching our database.

Help With Windows Service

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Charles A. Lackman - 26 Oct 2007 19:23 GMT
Hello,

I wrote a Windows Service is VB.NET and it works like clock work every
night.  The problems is that the driver I am using to connect to a
datasource become inactive at a period of time.  I destroy all it's
dependencies and recreate the connection every time the Windows Service
needs to retrieve the required data.  In spite of my efforts to create a new
connection to the datasource, I continually receive a communication error on
or about the 3 or 4 day (the data is retrieved every night).

The only way I have been able to get the data to pull (after I receive the
communication error) is to restart the Windows Service.

Is there a way to make the Windows Service Restart itself?

i.e..

Try

AConnection.Open
ACommand.ExecuteNonQuery
AConnection.Close
AConnection.Dispose

Catch Err as Exception
WriteToLogFile(Err.ToString)
AConnection.Close
AConnection.Dispose
Me.Restart

End try

I Found Code To Stop The Service, but once it's stopped, then how would I
start it.

Dim scm As New ServiceController(Me.ServiceName)
scm.Stop()

Chuck
Alvin Bruney [MVP] - 27 Oct 2007 02:47 GMT
Can you check to see if you have a connection leak? make sure that you have
not exhausted your connections to the datasource by using a trace on the
datasource.

Signature

Regards,
Alvin Bruney
------------------------------------------------------
Shameless Author Plug
OWC Black Book 2nd Edition
Exclusively on www.lulu.com/owc
$24.99

> Hello,
>
[quoted text clipped - 37 lines]
>
> Chuck

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.