Running An ASP Script As A Windows NT Service

window

SUMMARY

This tutorial will guide you through the steps of setting up and configuring a Windows NT Server or Workstation to execute an ASP script as a service. This will let you execute an ASP script without a user being logged on to the server, thus allowing you to use the ASP technology as a tool for automatic file processing or similar.

REQUIREMENTS

For this setup to work, the server must have the following software installed:

An ASP compliant web server. For instance, Microsoft Internet Information Server (IIS) version 3.0 or higher.
A webbrowser. For instance, Microsoft Internet Explorer.
The Windows NT Ressource Kit or at least the ServAny/InstSrv utilities available separately.
When doing all the following, you must be logged on as Administrator.

THE SCRIPT

The ASP script you want to run as a service should be written as plain ASP as you would normally do. Although, in case you want the script to "loop", you should make sure, that you output the appropriate HTML to initiate a reload of the script. This should look something like this:

   <%
       [ Perform whatever task you need ]
   %>

   <html>
   <head>
   <meta http-equiv="refresh" content="60; url=myScript.asp">
   </head>
   <body>
   ...
   </body>
   </html>

Generally, you would not generate any output, as the script will run in the background, not having anything to present to a user.

The HTML above assumes that the name of the script is myScript.asp and will reload the script (execute it) every 60 seconds.

Copy the script file to your webserver so it is accessible within the webserver namespace. From now on, I assume that you put it in the webserver root directory, so it is accessible via

http://localhost/myScript.asp

Eventually, test it using the webbrowser to make sure everything works as planned.

INSTALLING THE SERVICE

Setting up the service is pretty straight-forward if you follow the guideline provided with the NT Ressource Kit. Anyway, the following will guide you through just the nessecary steps.

We need the following files from the NT Ressource Kit:

   instsrv.exe        Utility to install Windows NT services
   srvany.exe         A service that will run any application

Although its optional, I recommend putting both files in your System32 directory. Now, start up a command prompt and execute this:

   instsrv myAspService srvany.exe

A new service named "myAspService" is now available through the Control Panel -> Services applet. Of course, you can provide any name you like.

CONFIGURING THE SERVICE

Now we need to configure the newly installed service to actually execute the script. As seen above, we need some host application to make the HTTP request - namely a webbrowser. In other words, we need to configure the service to execute the webbrowser with the appropriate URL as a parameter.

To configure the service, first open the Services applet in Control Panel. Locate the new service, double-click it, and make sure it is set to "Automatic" startup. Close the Control Panel applet.

Start up the registry editor (either regedit.exe or regedt32.exe).

Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services

Locate the name of your new service. Under this key, create a new key called "Parameters".

Under this new key, create the following two value/data pairs, both of type String/REG_SZ.

Value name:   Application
Data:         c:\Program Files\Plus!\Microsoft Internet\iexplore.exe

Value name:   AppParameters
Data:         http://localhost/myScript.asp

Of course, you must do any appropriate changes to paths and names in order to fit your system setup and installations paths.

Close the registry editor.

TESTING THE SERVICE

To test the entire setup, reboot the server. Afterwards, go to Control Panel -> Services and verify, that the service is running. Th

时间: 2024-09-19 09:27:27

Running An ASP Script As A Windows NT Service的相关文章

也不贴上,用ASP开发基于Windows NT Server和IIS的Web应用

iis|server|web|window 用ASP开发基于Windows NT Server和IIS的Web应用 国防科工委指挥技术学院 韩正清 钱明 摘要: 本文比较了CGI ISAPI与ASP在结构和性能方面的差异,并介绍了用ASP开发WEB 应用的一般过程.关键词: ASP CGI ISAPI IIS一.前言Internet/Intranet和WEB技术的出现和发展,为信息的交换和共享提供了快捷有效的方法,但Internet/Intranet上提供的信息多以静态网页为主,对于一个WEB应

把NT 4.0下的ASP应用迁移到Windows 2000上(1.1)

window     Windows 2000已经发布了,你可能已经开始考虑如何将ASP应用从Windows NT移植到2000中.如果现有的基于Windows NT的ASP应用不做改变是否可以运行在Windows 2000下呢?毕竟,迁移一个应用程序不是一项简单的工作,该怎样做才能让应用更平稳的过渡到Windows 2000上呢?     在移植的工作开始之前,你可能想知道哪些功能在Windows 2000下不会或只会造成很小的影响,或者哪些功能需要最小限度的改进以优化性能.你也可能想知道Wi

如何让你的ASP运行于非Windows平台

window 自从Micorsoft推出ASP技术后,由于ASP在创建动态交互式站点上的强大功能及其代码编写的简便性,使ASP在越来越多的Internet/Intranet/Extranet网站上得到了极其广泛的应用,尤其是涉及到数据库操作的网站应用系统更是倾向于采用ASP技术.但由于众所周知的原因,ASP只能工作于Microsoft的Windows NT平台+IIS Web Server服务器软件,在Windows9X+PWS也能使用,但那只能是调试或者学习用的,因而就决定了ASP应用的局限性

让你的ASP运行于非Windows平台

window 自从Micorsoft推出ASP技术后,由于ASP在创建动态交互式站点上的强大功能及其代码编写的简便性,使ASP在越来越多的Internet/Intranet/Extranet网站上得到了极其广泛的应用,尤其是涉及数据库操作的网站应用系统更是倾向于采用ASP技术.但由于众所周知的原因,ASP只能工作于Microsoft的Windows NT平台+IIS Web Server服务器软件,在Windows9X+PWS也能使用,但那只能是调试或者学习用的,因而就决定了ASP应用的局限性.

How to Create a Windows NT/ Windows 2000 Service(如何创建一个Windows NT/ Windows 2000 服务)

Introduction A Windows service is an EXE specially designed to communicate with the SCM (Service Control Manager) of Windows NT/2000. The Service Control Manager (SCM) maintains a database of installed services and driver services, and provides a uni

Windows NT 3.1

window 1993年Windows NT 3.1发布,这个产品是基于OS/2 NT的基础编制的,由微软和IBM联合研制.协作后来分开了,微软则把这个软件的名称改为它们的版本MS Windows NT,把主要的API改为32位的版本.微软公司从数字设备公司(Digital Equipment Corporation)雇佣了一批人员来开发这个新系统.这个系统的很多元素反映了早期的带有VMS和RSX-11的DEC概念.由于是第一款真正对应服务器市场的产品,所以稳定性方面比桌面操作系统更为出色.

Windows NT服务器维护经验

window|服务器 中国人民银行县支行服务器(Windows NT)一般既作为单位内部局域网的域控制器,又担负着网上公文处理.共享资源管理和收发电子邮件等重要任务,做好其日常维护工作具有重要意义.经过认真探索实践,笔者在工作中总结出以下经验与各位读者共享. 系统的自动登录通常情况下,用户在进入Win NT网络之前必须输入用户名称以及口令.为简化开机过程,可在启动时自动以某一个组的用户名称和口令来访问Win NT,而不需要通过人工设置的方法来输入登录参数.操作如下: 1.打开注册表编辑器,并在编

Windows NT攻击大看台

在当今的潮流下Windows NT已经成为了一种服务器操作系统的潮流,无论在局域网还是在互联网中,我们似乎都可以看到Windows NT的身影.但是由于它的源代码保密性和简单的图形接口,致使Windows NT成为了黑客们攻击的首选目标,寻找NT的漏洞也成为了黑客的一项基本工作. 为什么黑客会认为Windows NT的安全机制很脆弱呢?一个突出的问题是它的操作简单与便捷,还有就是它对于反向兼容的依赖,特别值得注意的是为了扩展市场不得不继续遵循一些网络中原有的通讯协议,这使得Windows NT的

在Windows NT 4.0下安装ActivePerl

active|perl|window 版本:1.0作者:何志强(hhzqq@sina.com)时间:2000.03.16 本文只讨论如何在Windows NT 4.0下安装ActivePerl.本文使用的环境: Windows NT 4.0 Option Pack 4.0 SP5 ActivePerl 522(APi522e.exe)一.软件下载    http://www.activestate.com/ActivePerl/download.htm二.软件安装 1.双击APi522e.exe