在窗口服务跟踪一个计算器错误 [英] Tracking down a stackoverflow error in an windows service

查看:165
本文介绍了在窗口服务跟踪一个计算器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了一个小的调整,以我的Windows服务中的一个,比我跑,并得到,

I made a small tweak to one of my windows services and than I ran it and got,

描述:这个过程被终止由于堆栈溢出

Description: The process was terminated due to stack overflow.

所以我又回到了一个老版本,并运行它,我仍然得到计算器错误。

So i went back to an old version and ran it and i'm still getting the stackoverflow error.

一部分是我调试都和我没有得到这个错误再次发生。如何/什么是找到什么导致溢出的窗口服务的最佳方式?

Worst part is i've debug both and i do not get this error to reoccur. How/what is the best way to find what's causing the overflow for a windows service?

推荐答案

您可以订阅的 AppDomain.UnhandledException 来记录异常。另一种选择是,以查看是否在服务崩溃和使用的WinDbg 追查问题。您也可以配置窗口来生成这些转储。 WinDbg中自带的脚本,它可以连接到进程和的生成转储当这个过程中崩溃

You can subscribe to AppDomain.UnhandledException to log the exception. Another option is to see if the crash dump got generated when the service crashed and use WinDbg to track down the issue. You can also configure windows to generate these dumps. WinDbg comes with the script that can attach to the process and generate dump when this process crashes.

此的文章

...并找到一个StackOverflowException并不难。如果您运行
!clrstack找到的200多行的调用堆栈可以或多或少
肯定的是,这是你的问题。

... and finding a StackOverflowException isn't that hard. If you run !clrstack and find a callstack of 200+ lines you can be more or less certain that this is your problem.

更新:

如果您使用.NET 4.0,你需要添加的 legacyCorruptedStateExceptionsPolicy 元素,以便登录AppDomain.UnhandledException例外服务配置文件。

If you use .NET 4.0, you need to add legacyCorruptedStateExceptionsPolicy element to the service config file in order to log exception in AppDomain.UnhandledException.

这篇关于在窗口服务跟踪一个计算器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆