D
DraguVaso
Hi,
I want to create a Service that Reads and Write Files, and Insert and Select
Data from a Sql Server Database.
I did a little test with a small Service that I wanted to write something to
a File when it starts and stops. I did it like this:
Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set things
' in motion so your service can do its work.
Dim swFile As StreamWriter =
File.AppendText("c:\ServicePieterP2.log")
swFile.WriteLine("blabla")
End Sub
Protected Overrides Sub OnStop()
' Add code here to perform any tear-down necessary to stop your
service.
Dim swFile As StreamWriter =
File.AppendText("c:\ServicePieterP2.log")
swFile.WriteLine("blabla2")
End Sub
I'm able to create and install the service, but when I Start it, the File
"c:\ServicePieterP2.log" is created, but nothing is written in it!! And when
I try to stop the service I got an error (time-out).
Can anybody help me with this? Is it possible to write to a file with a
service? does anybody knows a good site about making Services in VB.NET that
reads/writes filesand Sql Server?
Thanks a lot in advance,
Pieter
I want to create a Service that Reads and Write Files, and Insert and Select
Data from a Sql Server Database.
I did a little test with a small Service that I wanted to write something to
a File when it starts and stops. I did it like this:
Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set things
' in motion so your service can do its work.
Dim swFile As StreamWriter =
File.AppendText("c:\ServicePieterP2.log")
swFile.WriteLine("blabla")
End Sub
Protected Overrides Sub OnStop()
' Add code here to perform any tear-down necessary to stop your
service.
Dim swFile As StreamWriter =
File.AppendText("c:\ServicePieterP2.log")
swFile.WriteLine("blabla2")
End Sub
I'm able to create and install the service, but when I Start it, the File
"c:\ServicePieterP2.log" is created, but nothing is written in it!! And when
I try to stop the service I got an error (time-out).
Can anybody help me with this? Is it possible to write to a file with a
service? does anybody knows a good site about making Services in VB.NET that
reads/writes filesand Sql Server?
Thanks a lot in advance,
Pieter