C#:无法调试ASHX处理程序 [英] C#: Can't debug ASHX handler

查看:490
本文介绍了C#:无法调试ASHX处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.net C#4.0网站项目.我正在使用jQuery AJAX回发调用ASHX处理程序.通常,在调试C#时,我会使用Debug> Attach to Process>选择w3wp.exe并开始调试.

I have an ASP.net C# 4.0 website project. I am calling an ASHX handler using a jQuery AJAX postback. Normally when I debug C#, I use this method Debug > Attach to Process > select w3wp.exe and start debugging.

当我使用ASHX处理程序执行此操作时,Visual Studio会说不会命中断点.没有为该文档加载任何符号."果然,当我对处理程序运行AJAX调用时,没有命中断点.

When I do this with my ASHX handler Visual Studio says "The breakpoint will not be hit. No symbols have been loaded for this document." Sure enough, when I run the AJAX call to the handler, the breakpoint is not hit.

让我感到困惑的是,我可以否则调试C#文件,即ASPX文件的代码隐藏.

What confuses me is that I can debug C# files otherwise, i.e. the code-behind of an ASPX file.

推荐答案

事实证明,在Visual Studio尝试运行ASHX处理程序之前,它实际上不会加载用于调试的符号.我的问题竟然出在其他地方-jQuery代码中的一个错误,该错误称为处理程序.

It turns out that Visual Studio will not actually load symbols for debugging until it actually tries to run the ASHX handler. My problem turned out to be elsewhere - a bug in the jQuery code that called the handler.

起初我没有看到这个错误,所以假设处理程序被击中了.调用处理程序后,VS将允许您对其进行调试.我没有意识到ASHX处理程序的行为方式,我认为它们将像常规C#文件一样工作.

I didn't see this bug at first so assumed the handler was being hit. Once the handler is called, VS will then allow you to debug it. I didn't realise that ASHX handlers behaved this way, I thought they would work just like a regular C# file.

这篇关于C#:无法调试ASHX处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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