使用netbox把asp网站打包成本地运行的可执行程序
netbox相当于一个超级精简的IIS,按照其官方的说法是“NetBox 提供 Microsoft IIS 5.0 兼容的 Active Server Pages 模块,不用修改代码直接将已经存在的使用 ASP 开发的应用程序移植到 NetBox 平台上来”,程序下载 http://www.netbox.cn:88/download/index.htm
安装完成后,使用非常简单,下面是个小例子
建立一个文件夹 wwwroot,把asp网站的程序和数据库等文件放在这里,相当于是网站的根目录
与wwwroot同级目录建立一个main.box文本文件,内容如下
Dim httpd
Shell.Service.RunService “NBWeb”, “NetBox Web Server”, “NetBox Http Server Sample”
‘———————- Service Event ———————
Sub OnServiceStart()
Set httpd = NetBox.CreateObject(“NetBox.HttpServer”)If httpd.Create(“”, 8080) = 0 Then
Set host = httpd.AddHost(“”, “\wwwroot”)host.EnableScript = true
‘———————-默认首页文件定义
host.AddDefault “index.asp”
host.AddDefault “default.asp”
host.AddDefault “default.htm”httpd.Start
‘——–下面这里是定义运行exe文件后直接打开一个网页窗口,可以不要,直接在浏览器通过地址打开
Set htWin= CreateObject(“NetBox.HtmlWindow”)
htWin.ContextMenu=false
htWin.AllowClose=true
htWin.Width=723
htWin.Height=584
htWin.Title=”华康名家私8周年店庆抽奖系统”
htWin.scrollbar=false
htWin.Open “http://127.0.0.1:8080/”
htWin.ShowDialogelse
Shell.Quit 0
end if
End SubSub OnServiceStop()
httpd.Close
‘Shell.Quit 0
End SubSub OnServicePause()
httpd.Stop
End SubSub OnServiceResume()
httpd.Start
End Sub
再建立的main.box文件上右键,build,生成exe文件,运行之即可
近期评论