且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Visual Studio不允许MVC视图中的断点

更新时间:2023-11-09 20:06:34

这可能是由许多事情引起的,但是几个项目,以检查我最近帮助人们:

This could be caused by many things, but a few items to check which I've helped people with recently:


  • 第一步:DLL旁边必须有一个PDB文件启用调试。 (请参阅:什么是PDB文件?)确保您的PDB在执行目录

  • First step: there must be a PDB file alongside the DLL to enable debugging. (see: What is a PDB file?) Make sure you have the PDB in the executing directory.

清理以从bin文件夹中删除所有旧的DLL。

Clean to remove all the old DLLs from your bin folders.

确保您的应用程序正在运行当前代码的构建(与Visual Studio中相同的版本)。不要以为这只是因为你点击构建或部署。如果没有检测到变化,那么事情往往不会发生。检查程序集的构建时间,或更改某些内容并重新构建以查看文件大小更改。

Ensure that your application is running a build of your current code (the same version you have in Visual Studio). Don't assume that it is just because you clicked 'build' or 'deploy'. If no changes were detected then things often don't happen. Check the build time of the assembly, or change something and rebuild to see the file size change.

如果您正在运行Web相关的内容,请确保浏览器不缓存代码,否则IIS不会持续长时间运行的进程。

If you're running something web-related, make sure a browser isn't caching code, or IIS isn't holding a long running process.

杀死任何运行的Visual Studio开发服务器实例(您可以从任务管理器执行此操作,或者更简单地从系统托盘中执行此操作 - 它们看起来像IE徽标,当你将鼠标悬停在他们上面时,他们会告诉你他们运行哪个端口)。

Kill any running Visual Studio Development Server instances (you can do this from task manager, or more simply from the system tray - they look like an IE logo and when you hover over them they'll tell you which port they run on).

使用 iisreset 从命令提示符。

检查Visual Studio中调试的设置(工具>选项>调试>符号)您要自动加载符号,如果要链接其他程序集,则需要在此处引用其PDB文件。

Check the settings for Debugging in Visual Studio (Tools > Options > Debugging > Symbols) You want to automatically load symbols, and if you're linking other assemblies you need to reference their PDB files here.