如何使用IIS中托管的服务调试启动例外? [英] How to debug startup exceptions with service hosted in IIS?

查看:230
本文介绍了如何使用IIS中托管的服务调试启动例外?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的服务在IIS中运行。我发生了非致命异常并在启动时登录。

I have my service running in IIS. I have a non fatal exception occurring and being logged on startup.

如何将Visual Studio连接到IIS以便它还调试启动?

How do I attach Visual Studio to IIS so that it also debugs the startup?

我知道我可以将visual studio连接到 w3wp.exe ,以便在运行时进行调试。

I know I can attached visual studio to the w3wp.exe to debug while its running.

推荐答案

将以下内容添加到应用程序的启动代码中:

Add the following to your application's start up code:

System.Diagnostics.Debugger.Break();

当此行被命中时,系统将提示您将调试器附加到流程。参见 Debugger.Break 了解更多详情。

When this line is hit, you will be prompted to attach a debugger to the process. See Debugger.Break for more details.

这篇关于如何使用IIS中托管的服务调试启动例外?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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