调试类库

发布于 2024-11-16 01:49:25 字数 240 浏览 3 评论 0原文

我有从经典 ASP 调用的 ac# 类库。

是否可以使用 Visual Studio 进行调试?课堂上的断点不起作用,这并不奇怪。

我在 iis7 的浏览器中运行它,而不是通过 Visual Studio 2010,因为我使用的是经典的 ASP 页面。我是否需要在 Visual Studio 中运行它才能正常工作?

我也尝试使用 Response.writes,但结果是: 当前上下文中不存在名称“Response”

I have a c# class library that I am calling from Classic ASP.

Is it possible to debug this using visual studio? Break points in the class don't work, which isn't surprising.

I am running this on iis7 in the browser, rather than through Visual Studio 2010 because of the fact that I'm using a classic ASP page. Do I need to get this running in Visual Studio in order for this to work?

I also tried to use Response.writes, but they result in:
The name 'Response' does not exist in the current context

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

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

发布评论

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

评论(5

雨后咖啡店 2024-11-23 01:49:25

您需要将调试器附加到加载程序集的进程(IIS 或用于调试经典 ASP 应用程序的另一个调试器)。

在 VS2010 下,转到“工具”->“附加到进程(2008 年也可能相同)。

You need to attach the debugger to the process (either IIS or another debugger that you are using to debug your classic ASP application) that is loading the assembly.

Under VS2010 go to Tools -> Attach to Process (probably the same under 2008 as well).

猫瑾少女 2024-11-23 01:49:25

尝试添加库的代码:System.Diagnostics。 Debugger.Break(); 你想要中断的地方。还要确保使用 pdb 符号编译和部署 lib。当代码到达该指令时,IIS 将抛出异常。系统会要求您附加调试器,然后您就可以了。

try to add in the code of the lib: System.Diagnostics.Debugger.Break(); where you want to break. Also ensure the lib is compiled and deployed with the pdb symbols. When the code will reach the instruction, IIS will throw an exception. The system will ask you to attach a debugger, and you're on the way.

左秋 2024-11-23 01:49:25

我实际上写了一篇关于此的文章:

http://www.jameswiseman.com /blog/tag/visual-studio-2010/

摘自文章:

  1. 打开 Visual Studio 2010

    如果您安装了它,这很容易。如果您不这样做,可能会有点棘手;-)

  2. 在 Visual Studio 中打开您的网站

    再次,足够简单。

  3. 启动您的网站。
    即打开浏览器并导航到网站。

  4. 在 Visual Studio 中,单击“调试”菜单 -> “附加到进程”

  5. 您可能需要勾选标有“显示所有用户的进程”的框
  6. 如果应用程序保护较低,

    “Inetinfo.exe”;如果应用程序保护较高,则可能需要勾选“dllhost.exe”。您可能会看到“附加安全警告”弹出窗口。如果是这样,请继续。一开始有点害怕,但如果它是您自己 PC 上的应用程序,那就没问题了。
    在此处输入图像描述

    如果您对此感到担心,请遵循 MSDN 上的建议.

  7. 向您的代码添加一个断点,然后导航到您将遇到该断点的位置。

疑难解答 - 注册 pdm.dll

我第一次尝试时就成功了。后来的尝试并不是那么成功,我发现了一些不得不做的事情。

当尝试附加到“脚本代码”时,我在 IDE 中收到以下警告。

警告:无法调试脚本代码。这
pdm.dll 的版本不正确
挂号的。修复您的 Visual Studio
2010安装,或者运行
'regsvr32.exe
“%CommonProgramFiles%\Microsoft
共享\VS7Debug\pdm.dll”。

只需按照这些说明操作即可。

疑难解答 - 重新启动 IIS

这曾经也有帮助。实在说不出为什么。

I actually wrote an article regarding this:

http://www.jameswiseman.com/blog/tag/visual-studio-2010/

From the article:

  1. Open Visual Studio 2010

    This is easy enough if you have it installed. Might be a bit tricky if you don’t ;-)

  2. Open your website in Visual Studio

    Again, easy enough.

  3. Fire up your web site.
    I.e. open your browser and navigate to the website.

  4. In Visual Studio, click ‘Debug’ Menu -> ‘Attach to process’

  5. You may need to tick the box labelled ‘Show processes from all users’
  6. ‘Inetinfo.exe‘ if application protection is low or ”dllhost.exe‘ if application protection is higher. You may get an ‘Attach Security Warning’ popup. If so, continue On. It’s a bit scary at first, but if it’s your own app on your own PC, then you’ll be ok.
    enter image description here

    If you’re worried about this, follow the advice on MSDN.

  7. Add a breakpoint to your code, and navigate to a location where you will hit it.

Troubleshooting - Registering pdm.dll

This worked on the first occasion that I tried it. Subsequent attempts were not so successful, and I found a few things that I had to do.

When trying to attach to ‘Script Code’ I got the following warning in the IDE.

Warning: Cannot debug script code. The
correct version of pdm.dll is not
registered. Repair your Visual Studio
2010 installation, or run
‘regsvr32.exe
“%CommonProgramFiles%\Microsoft
Shared\VS7Debug\pdm.dll”‘.

Just follow these instructions.

Troubleshooting - Restart IIS

This also helped on one occasion. Can’t really say why.

树深时见影 2024-11-23 01:49:25

如果您将 .net 类包装在 Web 服务中,然后从经典的 ASP 页面调用该 Web 服务,您的生活将会变得更加轻松。

You will make your life much easier all round if you wrap you .net classes in a web service then call the web service from the classic asp pages.

绝對不後悔。 2024-11-23 01:49:25

对于调试,请将调试器附加到进程,如其他答案中所述。

对于跟踪,我发现类库中的System.Diagnostics.Trace.Writeline()与OutputDebugString侦听器(如调试视图

For debugging, attach the debugger to the process as described in other answers.

For tracing, I find very handy the combination between System.Diagnostics.Trace.Writeline() in the class library and an OutputDebugString listener like DebugView.

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