用vb6写asp组件(服务器组件)的简单例子

[ 2006-12-02 13:26:29 | 作者: admin ]
字号: | |
本机调试
1、重新启动www服务
2、重新生成dll

服务器注册
1、手工注册DLL ,有时候重新注册需要重新启动iis
regsvr32 RHasp.dll
反注册
regsvr32 /u RHasp.dll

2、另外还有一个方法可以不重新启动服务器
使用MTS(Microsoft Transaction Server)
MTS是IIS 4新增特色,但是它提供了巨大的改进。MTS允许你指定只有有特权的用
户才能够 访问组件,大大提高了网站服务器上的安全性设置。在MTS上注册组件的步骤如下:
(1) 打开IIS管理控制台。
(2) 展开transaction server,右键单击"pkgs installed"然后选择"new package"
(3) 单击"create an empty package"
(4) 给该包命名
(5) 指定administrator帐号或则使用"interactive"(如果服务器经常是使用administrator 登陆的话)
(6) 现在使用右键单击你刚建立的那个包下面展开后的"components"。选择 "new then component"
(7) 选择 "install new component"
(8) 找到你的.dll文件然后选择next到完成。

要删除这个对象,只要选择它的图标,然后选择delete.

参考例子
<%
‘调用的时候 server.createobject("工程名.类名")
set RHasp = server.CreateObject("RHasp.Functions")
RHasp.PrintInfo()
set RHasp = nothing
%>
'**********************************************
Private myScriptingcontext As ScriptingContext
Private myApplication As Application
Private myRequest As Request
Private myResponse As Response
Private myServer As Server
Private mySession As Session
'**********************************************

'*****************************************************************
Public Sub OnStartPage(passedscriptingcontext As ScriptingContext)
         Set myScriptingcontext = passedscriptingcontext
         Set myApplication = myScriptingcontext.Application
         Set myRequest = myScriptingcontext.Request
         Set myResponse = myScriptingcontext.Response
         Set myServer = myScriptingcontext.Server
         Set mySession = myScriptingcontext.Session
End Sub
'*****************************************************************

'*********************************
Public Sub OnEndPage()
         Set myScriptingcontext = Nothing
         Set myApplication = Nothing
         Set myRequest = Nothing
         Set myResponse = Nothing
         Set myServer = Nothing
         Set mySession = Nothing
End Sub
'********************************

Public Sub PrintInfo()
         myResponse.Write ("当前时间:" & Now())
End Sub

--------------------

attachments/200909/04_153409_tr071919990819_1.gif

attachments/200909/04_153413_tr071919990819_2.gif

attachments/200909/04_153416_tr071919990819_3.gif

attachments/200909/04_153419_tr071919990819_4.gif

attachments/200909/04_153422_tr071919990819_5.gif

attachments/200909/04_153426_tr071919990819_6.gif
[最后修改由 admin, 于 2009-09-04 16:57:22]
评论Feed 评论Feed: http://blog.xg98.com/feed.asp?q=comment&id=761

这篇日志没有评论。

此日志不可发表评论。