无法在 sharepoint 中调试自定义计时器作业

发布于 2024-12-05 08:14:14 字数 379 浏览 1 评论 0原文

我尝试了以下步骤来调试特定的自定义计时器(已安装并激活):

  1. 复制了 GAC 中的 .dll.pdb 文件。
  2. 重新启动计时器服务。
  3. 附加了 w3wpOWSTimer.exe 进程。

但调试仍然没有进行。放置的调试器是空圆圈,显示以下消息:

<块引用>

当前不会命中断点。该文档尚未加载任何符号。

OWSTimer 显示在不同的用户名中。它需要从我的帐户运行吗?

为什么调试不起作用?

I tried the following steps in order to debug a particular custom timer ( installed and activated):

  1. Copied the both .dll and .pdb files in the GAC.
  2. Restarted the timer services.
  3. Attached both w3wp and OWSTimer.exe processes.

But the debugging is still not taking place. The debugger placed is empty circle which displays this message:

The breakpoint will not currently be hit. No symbols have been loaded for this document.

The OWSTimer is shown in a diff username. Does It needs to be run from my account?

Why debugging is not working?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

亚希 2024-12-12 08:14:14

调试计时器作业可能很困难...您采取的步骤听起来不错,但您还可以执行更多操作:

  1. 计时器作业在 OWSTimer.exe 中运行 - 您只需附加到该步骤
  2. 即可 重新启动计时器服务。为了更好的措施,请重新启动、部署、重新启动、iisreset;-)
  3. 您是否进行了 DEBUG 构建或 RELEASE 构建?
  4. 确保您确实运行计时器作业(如触发它)

如果您的断点仍未命中,请执行一些难看的操作:使用Debugger.Launch()代码中的 Debugger.Break() 或始终失败的断言: System.Diagnostics.Trace.Assert(false);

然后是 MSDN 来救援

Debugging Timer Jobs can be hard... The steps you took sound about right, but you can also do some more:

  1. Timer Jobs run in OWSTimer.exe - you only need to attach to that one
  2. Restart the timer service. For good measure throw in a restart, deploy, restart, iisreset ;-)
  3. Did you do a DEBUG Build or RELEASE build?
  4. Make sure you actually RUN your timer job (as in trigger it)

If your breakpoints are still not hit, do something ugly: use Debugger.Launch() or Debugger.Break() in your code or an assertion which will always fails: System.Diagnostics.Trace.Assert(false);

And then there is MSDN for the rescue.

胡大本事 2024-12-12 08:14:14

尝试手动加载调试符号并查看其内容:

在中断模式或运行模式下显示模块窗口

调试菜单上,选择Windows,然后单击模块

默认情况下,“模块”窗口按加载顺序对模块进行排序。然而,
您可以选择按任何列排序。

在模块窗口中,可以看到哪些模块有调试
符号已加载。此信息显示在“符号状态”列中。
如果状态显示“已跳过加载无法找到或打开 PDB 文件”,
或通过包含/排除设置禁用加载,您可以直接
用于从 Microsoft 公共符号服务器下载符号的调试器
或从计算机上的符号目录加载符号。了解更多
信息,请参阅如何:使用符号服务器和如何:指定
符号位置和加载行为。

手动加载符号

在“模块”窗口中,右键单击未添加符号的模块
已加载。

指向“加载符号”,然后单击“Microsoft 符号服务器”或
符号路径。

复制自 MSDN

您也可以尝试删除 Visual Studio 缓存,以便确定(从命令提示符):

del /Q %LOCALAPPDATA%\Microsoft\WebsiteCache
del /Q %LOCALAPPDATA%\Temp\VWDWebCache
del /Q %LOCALAPPDATA%\Microsoft\Team Foundation\1.0\Cache

Try loading debug symbols manually and see what it says:

To display the Modules window in break mode or in run mod

On the Debug menu, choose Windows, and then click Modules.

By default, the Modules window sorts modules by load order. However,
you can choose to sort by any column.

In the Modules window, you can see which modules have debugging
symbols loaded. This information appears in the Symbol Status column.
If the status says Skipped loading Cannot find or open the PDB file,
or Loading disabled by include/exclude setting, you can direct the
debugger to download symbols from the Microsoft public symbol servers
or to load symbols from a symbol directory on your computer. For more
information, see How to: Use a Symbol Server and How to: Specify
Symbol Locations and Loading Behavior.

To load symbols manually

In the Modules window, right-click a module for which symbols have not
loaded.

Point to Load Symbols From and then click Microsoft Symbol Servers or
Symbol Path.

copied from MSDN

You can also try to delete Visual Studio cache just to be sure (from command prompt):

del /Q %LOCALAPPDATA%\Microsoft\WebsiteCache
del /Q %LOCALAPPDATA%\Temp\VWDWebCache
del /Q %LOCALAPPDATA%\Microsoft\Team Foundation\1.0\Cache
兮颜 2024-12-12 08:14:14

只是添加到 Moontear 的帖子中。

我遇到了相同的加载调试符号问题,直到我将此代码添加到 Execute 方法的第一行。

    public override void Execute(Guid contentDbId)
    {
        // If in debug mode, trigger a false assertion to give time 
        // to attach the debugger to the OWSTIMER.EXE process.
        #if (DEBUG)
            System.Diagnostics.Trace.Assert(false);
        #endif
        ...

Just adding to moontear's post.

I had the same loading debug symbols issue until I added in this code to the first line of my Execute method.

    public override void Execute(Guid contentDbId)
    {
        // If in debug mode, trigger a false assertion to give time 
        // to attach the debugger to the OWSTIMER.EXE process.
        #if (DEBUG)
            System.Diagnostics.Trace.Assert(false);
        #endif
        ...
凉风有信 2024-12-12 08:14:14

检查并确保您的区域设置正确 - 将 /_layouts/15/regionalsetng.aspx 附加到 CA URL。如果您的时区错误,您的工作可能会被安排在过去的时间。这已经让我不止一次挂断了。如果是这种情况,请设置正确的时区(使用上面的 url),停止并启动计时器服务(服务工具或打开命令行 - net stop sptimerv4 然后 net start sptimerv4 )。然后连接到 OWSTIMER 并进行调试。

Check to make sure your regional settings are correct - append /_layouts/15/regionalsetng.aspx to the CA URL. If you have the wrong time zone, your job may be scheduled for a time in the past. This has hung me up more than once. If this is the case, set the correct time zone (using the url above), stop and start the timer service (either services tool or open command line - net stop sptimerv4 then net start sptimerv4). Then attach to OWSTIMER and debug.

慵挽 2024-12-12 08:14:14
  1. 在“开始”菜单上,指向“管理工具”,然后单击“服务”。
  2. 在“服务”窗口中,确保 SharePoint 2010 计时器服务已启动。
  3. 打开包含计时器作业的 Visual Studio 2010 项目。
  4. 在作业定义类的 Execute 方法中设置断点。
  5. 在“调试”菜单上,单击“附加到进程”。
  6. 在“附加到进程”对话框中, c
  7. 如果显示“附加安全警告”对话框,请单击“附加”。
  8. 在 SharePoint 管理中心网站中,单击“监视”,然后单击“查看作业定义”。
  9. 单击作业名称,然后单击“编辑计时器作业”页面上的“立即运行”。
  10. 验证 Visual Studio 2010 调试器是否在断点上停止执行。单击 OWSTIMER.EXE,然后单击“附加”。
  1. On the Start menu, point to Administrative Tools, and then click Services.
  2. In the Services window, make sure the SharePoint 2010 Timer service is started.
  3. Open the Visual Studio 2010 project that contains your timer job.
  4. Set a breakpoint in the Execute method of your job definition class.
  5. On the Debug menu, click Attach to Process.
  6. In the Attach to Process dialog box, c
  7. If the Attach Security Warning dialog box is displayed, click Attach.
  8. In the SharePoint Central Administration Web site, click Monitoring and then click Review job definitions.
  9. Click the name of your job, and then click Run Now on the Edit Timer Job page.
  10. Verify that the Visual Studio 2010 debugger stops execution on your breakpoint.lick OWSTIMER.EXE, and then click Attach.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文