المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Can Window service Read Log.txt file ,if yes then how?



C# Programming
10-15-2009, 08:01 PM
I have create one file in c drive which and write in it and try to read from window service . Account:Local System, but it Cann't get any thing
Protected Overrides Sub OnStart(ByVal args() As String)
If Not File.Exists("C:\DevLog.txt") Then
EventLog1.WriteEntry("File Not Exist")
Else
Dim sr As StreamReader = New StreamReader("C:\DevLog.txt")
Dim tempstr As String = sr.ReadToEnd
If tempstr = "" Then
Else
EventLog1.WriteEntry("Get File Name")
st = tempstr
End If
sr.Close()
End If
End sub

Thanks in Advance.