【发布时间】:2022-01-21 22:20:02
【问题描述】:
我有一个 Windows 服务应用程序。该服务基本上是在特定时间将 Excel 文件复制到目录,然后读取 Excel 行,最后根据它读取的行中的数据更新 SQL Server 表。
最近,它有时会崩溃。在查看日志时,我发现它崩溃了,因为:
应用程序:WinCCServiceIzmit.exe 框架版本:v4.0.30319 说明:进程因未处理的异常而终止。
异常信息:System.IO.IOException
在 System.IO.__Error.WinIOError(Int32, System.String)
在 System.IO.FileStream.Init(System.String, System.IO.FileMode, System.IO.FileAccess, Int32, Boolean, System.IO.FileShare, Int32, System.IO.FileOptions, SECURITY_ATTRIBUTES, System.String, Boolean , 布尔值, 布尔值)
在 System.IO.FileStream..ctor(System.String,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,Int32,System.IO.FileOptions,System.String,布尔值,布尔值,布尔值)
在 System.IO.StreamWriter.CreateFile(System.String, Boolean, Boolean)
在 System.IO.StreamWriter..ctor(System.String, Boolean, System.Text.Encoding, Int32, Boolean)
在 System.IO.StreamWriter..ctor(System.String, Boolean)
在 System.IO.File.AppendText(System.String)
在 WinccService.InnerOperation.WriteToFile(System.String)
在 WinccService.InnerOperation.Stop()
在 WinccService.WinccIzmit.start()
在 System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
在 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
在 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
在 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
在 System.Threading.ThreadHelper.ThreadStart()
你们知道如何跟踪问题的根源吗?应用程序的代码行太多。
谢谢。
【问题讨论】:
标签: c# windows-services