|
|
|
|
|
netbox2.8使用说明与下载http://www.xishui.net 2008年09月21日00:43 浠水网
这个东西着实让我高兴了几天,有了它,对于ASP本地调试来说,完全可以取代iis,方便、灵活、快捷。也许你对这个东西有些了解,本文主要根据帮助文档的内容介绍下netbox2.8使用说明并提供该版本下载。 Dim httpd Sub OnServiceStop() Sub OnServicePause() Sub OnServiceResume() 3、再在目录下建一个1.asp,内容如下: <%="搜索吧"%>
Set Console = Shell.Console
Set httpd = CreateObject("NetBox.HttpServer") If httpd.Create("", 80) = 0 Then httpd.Start Console.ReadLine httpd.Stop httpd.Close End If Set httpd = Nothing
418 Host Not Found
第二步:添加虚拟主机 Set Console = Shell.Console
Set httpd = CreateObject("NetBox.HttpServer") If httpd.Create("", 80) = 0 Then httpd.AddHost "", "\wwwroot" httpd.Start Console.ReadLine httpd.Stop httpd.Close End If Set httpd = Nothing
Set Console = Shell.Console
Set httpd = CreateObject("NetBox.HttpServer") If httpd.Create("", 80) = 0 Then Set host = httpd.AddHost("", "\wwwroot") host.AddDefault "default.htm" httpd.Start Console.ReadLine httpd.Stop httpd.Close End If Set httpd = Nothing
Set Console = Shell.Console
Set httpd = CreateObject("NetBox.HttpServer") If httpd.Create("", 80) = 0 Then Set host = httpd.AddHost("", "\wwwroot") host.EnableScript = true host.AddDefault "default.asp" host.AddDefault "default.htm" httpd.Start Console.ReadLine httpd.Stop httpd.Close End If Set httpd = Nothing
<%Response.Write "Hello"%>
NetBox 也支持服务器 box 程序,在 wwwroot 目录中建立 test.box: Response.Write "Hello" 第五步:以服务方式运行 到目前为止,已经有一个相对完整的 Web 服务器程序了,下面我们需要将这个服务器改写为系统服务程序,可以将其安装成为一个系统服务,更加便于运行维护。改写成为服务程序需要使用 Service 对象。 下面便是一个完整的 Web 服务程序的代码,关于 Service 对象的更多信息请参阅手册相关内容。 Dim httpd Shell.Service.RunService "NBWeb", "NetBox Web Server", "NetBox Http Server Sample" '---------------------- Service Event --------------------- Sub OnServiceStart() Set httpd = CreateObject("NetBox.HttpServer") If httpd.Create("", 80) = 0 Then Set host = httpd.AddHost("", "\wwwroot") host.EnableScript = true host.AddDefault "default.asp" host.AddDefault "default.htm" httpd.Start else Shell.Quit 0 end if End Sub Sub OnServiceStop() httpd.Close End Sub Sub OnServicePause() httpd.Stop End Sub Sub OnServiceResume() httpd.Start End Sub 总结 实现一个完整的 Web 服务程序,需要 HttpServer,HttpServerHost,Service 三个对象的支持,HttpServer 负责建立服务器并控制服务器的运行状态,HttpServerHost 负责建立主机信息, Service 则负责完成与服务程序相关的操作。 使用过程中需要注意的是: If httpd.Create("",83) = 0 Then 这里为什么是83呢?因为我使用80的时候有冲突,导致netbox2.8打开后没反应,所以你也这样建议你也换个端口。
【发表评论】
|
|||||||