global.asax断点未命中 [英] global.asax breakpoint not hit

查看:150
本文介绍了global.asax断点未命中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#中的ASP.NET应用程序中的某些代码位于 Global.asax.cs 代码文件中。在 Application_Start Session_Start Application_Begin Request 中,一些断点。但是这些都没有受到打击。我正在使用VS8在本地计算机上工作。

I have some code in my ASP.NET app in C# that's in the Global.asax.cs code file. In the Application_Start, Session_Start and Application_Begin Request I have set some breakpoints. However none of these are ever hit. I'm working on my local machine with VS8.

这是我尝试过的操作:


  • 停止ASP Dev Server

  • 删除所有ASP.NET临时文件

  • 创建新的 Global.asax

  • 关闭VS并打开备份

  • 清理和重建项目

  • Stopped the ASP Dev Server
  • Deleted all ASP.NET Temporary files
  • Created new Global.asax
  • Closing VS and opening back up
  • Clean and Rebuild project

尝试这些操作后,断点将不会出现。

Upon trying my after these, the breakpoints will not hit.

任何想法为什么会这样?

Any ideas why this might be?

推荐答案

我遇到了同样的问题。我假设您使用的是本地IIS,而不是VS Development Server。在这种情况下,您将无法在Global.asax.cs文件中进行调试/单步执行,因为在附加调试器时,该代码已在IIS中执行。但是,如果使用Dev服务器,则可以获取此代码,因为调试器将已附加。

I've run into this same problem. I'm assuming you are using your local IIS instead of the VS Development Server. If this is the case, you won't be able to debug/Step through this code in the Global.asax.cs file because by the time the debugger has attached, this code has already executed in IIS. However, if you use the Dev server, you have the ability to get to this code as the debugger will already be attached.

因此,请在项目属性中更改服务器即可使用Visual Studio Development Server。

So, Change the server in your project properties to use the Visual Studio Development Server.

可以通过在Visual Studio中右键单击您的项目> 项目属性> Web选项卡> 使用Visual Studio开发服务器

This can be found by right clicking your project within Visual Studio > Project Properties > Web tab > Use Visual Studio Development Server.

这篇关于global.asax断点未命中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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