netbox开启服务后自动访问首页

本文介绍如何配置NetBox服务实现自动启动并访问首页。通过VBS脚本创建NetBoxHttpServerSample服务,设置HTTP服务器监听800端口,并在服务启动时自动打开默认页面index.html。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

netbox开启服务后自动访问首页

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("", 800) = 0 Then
        Set host = httpd.AddHost("", "/wwwroot")
        host.EnableScript = true
        host.AddDefault "index.html"
        httpd.Start
    else
        Shell.Quit 0
    end if
 Set ht = CreateObject("NetBox.HtmlWindow")
 ht.open "
http://localhost/index.html "
 ht.showDialog

End Sub
Sub OnServiceStop()
    httpd.Close
End Sub
Sub OnServicePause()
    httpd.Stop
End Sub
Sub OnServiceResume()
    httpd.Start
End Sub

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值