【发布时间】:2012-10-13 19:18:33
【问题描述】:
我有一个计划任务设置为在 IE7 中每 3 分钟运行一次 Scan.aspx。 Scan.aspx 依次从 10 个文件中读取数据。这些文件不断更新。文件中的值被插入到数据库中。
偶尔,正在读取的值会被截断或扭曲。例如,如果文件中的值为“Hello World”,则数据库中将出现“Hello W”、“Hel”等随机条目。这些条目上的时间戳看起来完全随机。有时是凌晨 1:00,有时是凌晨 3:30。有些晚上,这根本不会发生。
我在调试代码时无法重现此问题。所以我知道在“正常” 情况下,代码可以正确执行。
更新:
这是读取文本文件的 aspx 代码隐藏(在 Page_Load 中)(对 10 个文本文件中的每一个都调用):
Dim filename As String = location
If File.Exists(filename) Then
Using MyParser As New FileIO.TextFieldParser(filename)
MyParser.TextFieldType = FileIO.FieldType.Delimited
MyParser.SetDelimiters("~")
Dim currentrow As String()
Dim valueA, valueB As String
While Not MyParser.EndOfData
Try
currentrow = MyParser.ReadFields()
valueA= currentrow(0).ToUpper
valueB = currentrow(1).ToUpper
//insert values as record into DB if does not exist already
Catch ex As Exception
End Try
End While
End Using
End If
知道为什么这可能会在一天中多次运行(通过计划任务)时导致问题吗?
【问题讨论】:
标签: asp.net iis internet-explorer-7 scheduled-tasks webforms