不正确的“无法开始调试...无法附加到 ASP.NET 辅助进程” Delphi 2007 for .NET 中的消息

发布于 2024-08-20 08:10:53 字数 1001 浏览 4 评论 0原文

我看到这个问题很久了,最后决定把这个问题提出来。我需要维护一些用 Delphi 2007 for .NET (ASP.NET 2.0) 编写的应用程序。通常,第一次运行应用程序(使用 IIS)时,我会收到经典的“无法在 Web 服务器上开始调试。无法附加到 ASP.NET 工作进程”消息。我只需再次按 F9(运行),它就会运行。有时我必须尝试运行几次才能真正运行。

我运行的是 Windows 7 64 位(并且在 Vista 64 位上看到了相同的效果)。我确实为 ASP.NET 配置了 IIS,并且我的 Web.config 文件中确实有以下代码。

  <system.webServer>
      <modules>
         <add name="DbgConnect" type="Borland.DbkAsp.DbkConnModule,Borland.dbkasp,Version=10.5.0.0,
           Culture=neutral, PublicKeyToken=b0524c541232aae7" preCondition="managedHandler" />
      </modules>
      <validation validateIntegratedModeConfiguration="false" />
  </system.webServer>

关键是我最终可以在调试器中运行应用程序,有时甚至是第一次尝试。很多时候,当我遇到失败时,它会在我按“运行”后大约 15 秒左右发生,有时甚至在我点击 Web 应用程序的一两页(或三页)之后。而且,是的,当 Delphi 进入这种模式时,我可以简单地运行而无需调试,一切都很好(除非我真的想调试)。而且,我可以继续尝试在调试器中运行,最终它会正常工作。

看来 Delphi 的 .NET 调试器以某种方式发现应用程序无法运行,然后放弃并停止该进程(正如我所提到的,该进程有时显然正在运行)。

我知道其他开发人员也看到过这种行为。我的问题是,有人知道如何阻止这种烦人的行为吗?

I have seen this for a long time, and finally decided to put the question up here. I have some applications that I need to maintain that were written in Delphi 2007 for .NET (ASP.NET 2.0). Normally, the first time I run the application (using IIS) I get the classic "Unable to start debugging on the web server. Unable to attach to ASP.NET worker process" message. I simply press F9 (run) again, and it runs. Sometimes I have to try running several times before it will actually run.

I am running Windows 7 64-bit (and have seen the same effect on Vista 64-bit). I do have IIS configured for ASP.NET, and I do have the following code in my Web.config file.

  <system.webServer>
      <modules>
         <add name="DbgConnect" type="Borland.DbkAsp.DbkConnModule,Borland.dbkasp,Version=10.5.0.0,
           Culture=neutral, PublicKeyToken=b0524c541232aae7" preCondition="managedHandler" />
      </modules>
      <validation validateIntegratedModeConfiguration="false" />
  </system.webServer>

The point is that I eventually can run the application in the debugger, sometimes even on the first try. Many times when I get the failure it happens about 15 seconds or so after I press Run, sometimes even after I've hit a page or two (or three) of the Web app. And, yes, when Delphi gets into this mode, I can simply run without debugging, and all is fine (unless I really want to debug). And, I can just keep on trying to run in the debugger and eventually it will just work.

It appears that Delphi's .NET debugger is somehow getting the idea that the application cannot run, and then gives up and stops the process (which as I've mentioned is sometimes clearly running).

I know of other developers who have also seen this behavior. My question is, does anyone know how to stop this annoying behavior?

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

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

发布评论

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

评论(2

貪欢 2024-08-27 08:10:53

我不记得确切的错误消息,但我相信我过去至少见过类似的东西。我所做的就是在 .NET 2.0 Framework 上运行“修复”(通过控制面板 --> 添加/删除程序)。然后也许之后重新启动计算机...

I don't remember the exact error message, but I believe I've seen something at least similar to this in the past. All I did to fix it was run a "Repair" on the .NET 2.0 Framework (through Control Panel --> Add/Remove Programs). Then maybe restart your computer after that...

悲欢浪云 2024-08-27 08:10:53

如果您遇到此问题,您将继续遇到此问题。不过,这里有一个解决方法。

首先运行您的项目而不进行调试,然后在项目运行后附加到它。为此,请选择“运行”|“运行而不调试,或按 Ctrl-Shift-F9。

应用程序启动并运行后,并且您希望调试器的服务可用,请选择“运行”|“调试器”。附加到进程。在“附加到进程”对话框中,将“调试器”下拉列表设置为“CodeGear .NET 调试器”。 IIS 现在将出现在“正在运行的进程”列表框中。在我的机器上,它显示为 w3wp.exe。取消选中“附加后暂停”复选框,然后单击“附加”。 (第一次使用“附加到进程”对话框后,它将默认使用 .NET 调试器,并且不会选中“附加后暂停”。)

您现在正在启用调试器的情况下运行。如果遇到断点,或者遇到异常,或者选择 Run |程序暂停,调试器将被加载。如果要禁用调试器而不关闭应用程序,请选择“运行”|“调试器”。从程序中分离。

显然,由于应用程序已经在运行,因此不涉及放弃并给出虚假错误消息的任何内容。

更重要的是,使用这种方法调试 Delphi for .NET 应用程序有一个很好的副作用。一旦运行并发现问题,您可以弹出调试器并查看内部发生了什么。如果发现需要修复的问题,请从进程中分离出来,修复问题,然后重新编译。您可以让应用程序在 IIS 中运行。

重新编译项目后,您使用 IIS 在应用程序中点击的下一个页面将导致加载更新的程序。如果您再次需要调试器,只需附加到 IIS 进程即可。换句话说,您可以调试、修复、重新编译、调试、修复、重新编译...,而无需关闭浏览器中的应用程序。

If you have this problem, you're going to continue to have this problem. However, here is a workaround.

Begin by running your project without debugging, and then attach to it once it is working. To do this, select Run | Run Without Debugging, or press Ctrl-Shift-F9.

Once your application is up and running, and you want to have the services of the debugger available, select Run | Attach to Process. From the Attach to Process dialog box, set the Debugger dropdown to CodeGear .NET Debugger. IIS will now appear in the Running Processes listbox. On my machine, it appears as w3wp.exe. Uncheck the Pause After Attach checkbox, and then click Attach. (After using the Attach to Process dialog box the first time, it will default to the .NET debugger and Pause after attach will not be checked.)

You are now running with the debugger enabled. If you hit a breakpoint, or encounter an exception, or select Run | Program Pause, the debugger will be loaded. If you want to disable the debugger without closing the application, select Run | Detach From Program.

Apparently, since the application is already running, whatever was giving up and giving the false error message is not involved.

On the plus size, there is a nice side effect of using this approach to debugging a Delphi for .NET application. Once you are runninng, and find a problem, you can pop into the debugger and see what's going on inside. If you find a problem to fix, detach from the proces, fix the problem, and re-compile. You can leave your application running in IIS.

Once the project has been re-compiled, the next page you hit in the application using IIS will cause the updated program to load. If you need the debugger again, simply attach to the IIS process. In other words, you an debug, fix, recompile, debug, fix, recompile,... without having to ever close the application in your browser.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文