• ----:)欢迎访问源码网(:----
    • 首页
    • 博客
    • 学院
    • 下载
    • 论坛
    • 影视
    • 发布源码
    • RSS
    • ITPig
    • 笑话网
    • 百家姓
    • 繁體中文

源码网 - 中国第一源码门户
选择镜像:网通镜像 - 电信主站
  • 首 页
  • 新闻动态
  • 网站运营
  • 网页制作
  • WEB开发
  • 编程开发
  • 图像媒体
  • 操作系统
  • 数据库
  • 服务器
热门搜索 优化 SEO 故事 cms IIS7 MySQL 个人 AdSense 主题推广 | 文章搜索: 高级搜索
会员登录/控制面版您的位置: 学院首页 >> WEB开发 >> ASP开发 >> 组件开发 >> 详细内容
 

推荐文章

 
 

热点文章

  • VB编写ActiveX DLL实现ASP编程
  • 汉字转换拼音(带音调)Asp版
  • 新生命Web服务器v1.1源码
  • VB编写ASP组件的调试
  • 使用ASPJPEG添加水印的方法
  • 用VB将ASP代码封装成DLL
  • 常见ASP组件介绍及下载
  • 用VB生成DLL封装ASP代码,连接数据库
  • 使用VB编写纯ASP程序
  • 调用winrar压缩文件夹
  • 利用OWC画图的例子
  • Asp生成条形码
 
 

相关文章

  • FreeBSD下构建安全的Web服务器
  • Nginx 0.6.31 + PHP 5.2.6(FastCGI)搭建胜过Apache十..
  • LEMP构建高性能WEB服务器(第二版)
  • 微软的下一代Web服务器IIS7细节披露!
  • 主流WEB服务器软件比较
 
 

百度搜索

 
 

新生命Web服务器v1.1源码

  • 阅览次数:
  • 文章来源: nnhy
  • 原文作者: 大石头
  • 整理日期: 2007-03-04
  • 发表评论
  • 字体大小:
  • 小
  • 中
  • 大

总想说点什么……

想想两年前,2004年12月31日晚,我在网络上建立的NewLife这个组织,当时学ASP的那个狂潮呀……

两周年庆即将到来,希望众多说ASP落后的朋友,看看ASP还能做什么……

好了,现在公布 新生命页面开发专用Web服务器v1.1 的源码,曾有人要买,呵呵,其实不值钱……

基于NetBox做的,可以到http://www.codepub.com/software/view-software-9076.html上下载NetBox2.8,才能运行

作为NetBox群兄弟学习用吧。

以下是代码片段:

Dim httpd
Dim retVal

Dim ServiceName
Dim DisplayName

ServiceName = "NewLifeWebServer"
DisplayName = "新生命页面应用开发专用Web服务器"

'Shell.Service.RunService "NLWeb", "新生命专用Web服务器,80端口,支持ASP", "新生命页面应用开发专用"

Shell.Service.Name = ServiceName
Shell.Service.DisplayName  = DisplayName & " 作者 大石头 http://www.nnhy.org"
Shell.Service.Description  = DisplayName

If Shell.Service.Running then
 retVal = Shell.MsgBox("本程序的另一个副本已启动,是否强制终止?", DisplayName, vbOKCancel)
 If retVal = 2 then
     Shell.Quit 0
   End If
 Shell.Service.SendCommand 200 '发送终止指令
 NewLife.Sleep 1000 '等待终止
End If

Shell.Service.RunService ServiceName

'---------------------- Service Event ---------------------

Sub OnServiceStart()
 Shell.Service.AppendCommand 101, "开始服务"
 Shell.Service.AppendCommand 102, "暂停服务"
 Shell.Service.AppendCommand 103, "重启服务"
 Shell.Service.AppendCommand -1
 Shell.Service.AppendCommand 0, "打开主页"
 Shell.Service.AppendCommand 104, "作者介绍"

    Set httpd = NetBox.CreateObject("NetBox.HttpServer")

    If httpd.Create("", 80) <> 0 Then
     Shell.Beep
  Dim retVal
  retVal = Shell.MsgBox("端口可能已经被IIS占用,是否停止IIS?", DisplayName, vbOKCancel)
  If retVal = 2 then
         Shell.Quit 0
       End If
       Shell.Execute "Net Stop W3SVC", 16
  If httpd.Create("", 80) <> 0 Then
   Shell.Beep
   Shell.MsgBox "很抱歉,Web服务无法启动!", DisplayName
         Shell.Quit 0
       End If
 End If
 
    Set host = httpd.AddHost("", "")

    host.EnableScript = true
    host.EnableBrowse = true
 host.EnableDebug = true
    host.AddDefault "index.asp"
    host.AddDefault "index.htm"
    host.AddDefault "index.html"
    host.AddDefault "default.asp"
    host.AddDefault "default.htm"
    host.AddDefault "default.html"

    httpd.Start
   
    Dim RndForOpenNnhyOrg '百分之一的概率打开http://www.nnhy.org
    Randomize
    RndForOpenNnhyOrg = Int((100 * Rnd) + 1)   ' 产生 1 到 100 之间的随机数。
    If RndForOpenNnhyOrg = 1 Then OpenUrl "http://www.nnhy.org"
End Sub

Sub OnServiceStop()
    httpd.Close
End Sub

Sub OnServicePause()
    httpd.Stop
End Sub

Sub OnServiceResume()
    httpd.Start
End Sub

Sub OnServiceCommand(uCtrl)
 'Shell.MsgBox "被迫退出" & uCtrl, "nnhy"
 Select Case uCtrl
  'Case 3 '开始服务
   '   Shell.MsgBox "开始服务", "nnhy"
   '   httpd.Start
  'Case 2 '暂停服务
   '   Shell.MsgBox "暂停服务", "nnhy"
   '   httpd.Stop
  'Case 16 '重启服务
   '   Shell.MsgBox "重启服务", "nnhy"
   '   httpd.Close
  Case 101 '开始服务
      httpd.Start
  Case 102 '暂停服务
      httpd.Stop '停止服务器运行将暂停接受新的连接请求,对于已经建立的连接没有影响。
  Case 103 '重启服务
      httpd.Close '关闭服务器对象将关闭所有已经建立的连接,等待正在处理的连接线程全部结束,并清除服务器所占用的资源。
      Shell.Execute NewLife.ApplicationName
      Shell.Halt 0
  Case 104 '打开http://www.nnhy.org
   OpenUrl "http://www.nnhy.org"
  Case 200
   httpd.Close
   'Shell.MsgBox "被迫退出", "nnhy"
   'Shell.Quit 0
   Shell.Halt 0
  Case else '打开主页
   OpenUrl "http://127.0.0.1"
 End Select
End Sub

Sub OpenUrl(url)
 Set htWin= CreateObject("NetBox.HtmlWindow")
 htWin.Title = Shell.Service.DisplayName
 htWin.ResizAble = false
 htWin.Center
 htWin.ScrollBar = false
 htWin.Open url
 htWin.ShowDialog
End Sub

上一篇:PHP使用zlib扩展实现页面GZIP压缩输出
下一篇:构建支持Master/Slave读写分离的数据库操作类
  • 网友评论:
  • 查看所有评论
  • 我要发表评论
您的网名:
留言主题:
你要发表的内容:

 

关于本站 | 广告联系 | 版权声明 | 网站地图 | 发布软件 | 帮助中心 | 源码论坛

Copyright © 2005-2007 CodePub.Com  程序支持:木翼  滇ICP备05005971号