【问题标题】:On recycle some applications get this error: Thread was being aborted在回收一些应用程序得到这个错误:线程被中止
【发布时间】:2018-10-20 02:50:41
【问题描述】:

由于某些原因,某些应用程序在回收后一直抛出以下错误:

Thread was being aborted.
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.Load(String assemblyString)
   at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)

什么意思?

【问题讨论】:

  • 回收时,如果有任何长时间运行的任务/线程,它们最终会被中止,以便进程重新启动。

标签: c# asp.net recycle


【解决方案1】:

这意味着在您的代码中某处正在创建一个线程,该线程花费的时间超过了关闭超时允许完成其工作的时间。该线程必须被强制关闭,而强制关闭的方式是通过 Thread.Abort() 调用。

因此,请检查您的代码是否存在无限的while 循环或具有不正确结束条件的for 循环。然而,这可能只是由任何需要超过 30 秒左右才能完成工作的慢代码造成的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-08
    相关资源
    最近更新 更多