简体   繁体   English

Delphi 2007 for .NET中的“无法启动调试...无法附加到ASP.NET辅助进程”消息

[英]Incorrect “Unable to start debugging…Unable to attach to ASP.NET worker process” message in Delphi 2007 for .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). 我有一些我需要维护的应用程序是用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. 通常,我第一次运行应用程序(使用IIS)时,我会得到经典的“无法在Web服务器上启动调试。无法附加到ASP.NET工作进程”消息。 I simply press F9 (run) again, and it runs. 我只需按F9(运行)再次运行。 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). 我正在运行Windows 7 64位(并且在Vista 64位上看到了相同的效果)。 I do have IIS configured for ASP.NET, and I do have the following code in my Web.config file. 我确实为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>

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. 很多时候,当我遇到故障时,它会在我按下Run后大约15秒左右发生,有时甚至在我点击一两页(或三个)Web应用程序之后。 And, yes, when Delphi gets into this mode, I can simply run without debugging, and all is fine (unless I really want to debug). 并且,是的,当Delphi进入这种模式时,我可以简单地运行而无需调试,一切都很好(除非我真的想调试)。 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). 似乎Delphi的.NET调试器在某种程度上得到了应用程序无法运行的想法,然后放弃并停止进程(正如我所提到的那样,有时候显然正在运行)。

I know of other developers who have also seen this behavior. 我知道其他开发者也看到了这种行为。 My question is, does anyone know how to stop this annoying behavior? 我的问题是,有谁知道如何阻止这种烦人的行为?

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). 我所做的就是在.NET 2.0 Framework上运行“修复”(通过控制面板 - >添加/删除程序)。 Then maybe restart your computer after that... 然后可能会重启你的电脑......

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. 无需调试运行,或按Ctrl-Shift-F9。

Once your application is up and running, and you want to have the services of the debugger available, select Run | 一旦您的应用程序启动并运行,并且您希望调试器的服务可用,请选择Run | Attach to Process. 附加到流程。 From the Attach to Process dialog box, set the Debugger dropdown to CodeGear .NET Debugger. 从Attach to Process对话框中,将Debugger下拉列表设置为CodeGear .NET Debugger。 IIS will now appear in the Running Processes listbox. IIS现在将显示在“正在运行的进程”列表框中。 On my machine, it appears as w3wp.exe. 在我的机器上,它显示为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.) (第一次使用“附加到进程”对话框后,它将默认为.NET调试器,并且不会选中“附加后暂停”。)

You are now running with the debugger enabled. 您现在正在运行启用调试器。 If you hit a breakpoint, or encounter an exception, or select Run | 如果遇到断点,或遇到异常,或选择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. 在加号上,使用这种方法调试Delphi for .NET应用程序有一个很好的副作用。 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. 您可以让您的应用程序在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. 重新编译项目后,使用IIS在应用程序中命中的下一页将导致加载更新的程序。 If you need the debugger again, simply attach to the IIS process. 如果再次需要调试器,只需附加到IIS进程即可。 In other words, you an debug, fix, recompile, debug, fix, recompile,... without having to ever close the application in your browser. 换句话说,您需要调试,修复,重新编译,调试,修复,重新编译,...而无需在浏览器中关闭应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法附加到asp.net工作进程,因为它不在进程列表中 - Unable to attach to asp.net worker process as it is not in the process list ASP.net无法将文件附加为数据库 - ASP.net unable to attach file as database 无法在Web服务器上启动调试。 无法启动Asp.Net调试 - Unable to start debugging on the web server. Could not start Asp.Net debugging 调试w / Attach to Process启动ASP.NET Dev Server - Debugging w/ Attach to Process Starts ASP.NET Dev Server 无法使用 HTTPS 启动 ASP.NET Core - Unable to start ASP.NET Core with HTTPS 无法在Web服务器上启动调试。无法启动ASP.NET调试VS 2010,II7,Win 7 x64 - Unable to start debugging on the web server. Could not start ASP.NET debugging VS 2010, II7, Win 7 x64 错误:“无法在 web 服务器上开始调试...”ASP.NET 4.0 - Error : "Unable to start debugging on the web server..." ASP.NET 4.0 为什么运行asp.net时会出现“无法在Web服务器上启动调试”? - Why do I get “Unable to start debugging on web server” when running asp.net? 无法将实时事件附加到asp.net中的div中 - Unable to attach a live event to anchor within div in asp.net 调试时无法更改ASP.NET代码隐藏 - Unable to make changes to ASP.NET Code Behind while Debugging
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM