asp_dll[2]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 uheart 的 blog

     famelstudio(2003-7-3 21:31:40)

howto: debug a visual basic dll from visual interdev
--------------------------------------------------------

this article was previously published under q200998
summary
this article demonstrates how to debug a visual basic activex dynamic-link library (dll) using visual interdev 6.0 or later.
more information
the component object model (com) dll needs to be registered on the computer that is creating the object (through server.createobject).
step-by-step example
start visual basic on the computer where visual interdev will be used for debugging, and create a new activex dll.
change the name of the project to myvbcomponent.
change the name of the class module to cmyclass.
add the following code to the dll:
public function debugtest (vntnum1 as variant, vntnum2 as variant) as variant
      debugtest = vntnum1 + vntnum2
  end function
                                       
from the file menu, click make myvbcomponent.dll.
set a breakpoint on the "debugtest = vntnum1 + vntnum2" line in the dll.
from the run menu, click start (or press the f5 key) to run the program.
start visual interdev, and add a new active server pages (asp) page to the project.
add the following code to the new asp page:
  <%
      dim objmycomponent, vntnum1, vntnum2, vntresult
      vntnum1 = 1
      vntnum2 = 2
      set objmycomponent = server.createobject("myvbcomponent.cmyclass")
      vntresult = objmycomponent.debugtest(vntnum1, vntnum2)
      response.write(vntresult)
  %>
                                       
place a breakpoint within the asp page on the line that calls the debugtest method.
in the project explorer window of visual interdev, right-click this asp page, and then click set as start page.
from the debug menu, click start (or press f5) to run the program.
note: if your project is not already configured within microsoft internet information server (iis) for debugging, visual interdev prompts you to set this up. click yes in all of the dialog boxes that visual interdev presents, and visual interdev configures this automatically. also note that the function keys that are used for debugging are different in visual interdev and visual basic.

if the dll is already loaded, you must restart iis before you can debug the dll, or you cannot stop on breakpoints. to restart iis 4.0, type the following commands at a command prompt:
net stop iisadmin /y
mtxstop
net start w3svc

to restart iis 5.0, type the following command at a command prompt:
iisreset

references
for additional information%1, click the article numbers below to view the articles in the microsoft knowledge base:
198432 prb: server object error 'asp 0178' instantiating com object

259725 prb: error when you debug com+ in the vb ide with asp client

244272 info: visual interdev 6.0 debugging resources

     smuzy(2003-7-3 16:03:03)

neu_leaf:
    我也意识到这个问题,重复的编译后,注册表中有好多冗余的注册项。但是我使用的时候到现在为止还没有因为这个出现过问题。我在自己做开发的机子上就这么用了,感觉非常方便。不知道会不会什么时候突然出现故障。

你能不能详细的解释一下,如何把他注册到组建服务中,里面的有些选项我不是很清楚。

至于iisreset则运行起来太慢了,我忍受不了。赫赫
     neu_leaf(2003-7-3 15:10:59)

像你这样的编译,会导致注册表错乱!
建议,对于一个组件服务器,即dll,在机器上面只保留一个注册,(可以采用版本支持,或者在重建一个之前把以前的删掉)!

如果你觉得重新编译很麻烦的话,我建议:如果是在win2000下的话,可以把dll注册到组件服务中,要重新编译时只需停以下即可,很快,很简单;如果在无法使用组件服务的情况下,那就只用重起iis服务了。


     hnliuwx(2003-7-3 13:03:04)

运行iisreset,然后重新编译dll,就可以覆盖了。

本文关键:asp_dll
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top