我在生产服务器中有一个日志文件,它不断被程序更新(非常频繁。比如说每秒5到10次)。
这个日志文件显然只对Dev服务器是只读的,文件大小可能达到~4MB。
我在Dev环境中有一个程序。它会定期读取文件内容并查找特定的行/关键字。
************************
If File.Exists(targetFile) Then
Using fs As FileStream = New FileStream(targetFile, FileMode.Open, FileAccess.Read)
Using sr As StreamReader = New StreamReader(fs)
Dim all As String = sr.ReadToEnd()
allLines = all.Split(Environment.NewLine)
End Using
End Using
End If
********************************
我的问题是,它似乎是从开发服务器读取锁定文件[不确定]。所以该服务是PRD无法访问该文件并抛出错误。