Running an ASP Script as A Windows NT Service

Source: Internet
Author: User
Tags http request root directory
Window SUMMARY

This tutorial would 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'll let you execute a ASP script without a user being logged on to the server, thus allowing you to use the ASP Tec Hnology 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 of the following, you are must is logged on as Administrator.

The SCRIPT

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

<%
[Perform whatever task you need]
%>

<meta http-equiv= "Refresh" content= "60; Url=myscript.asp ">
<body>
...
</body>

Generally, you would not generate any output, as the script would run in the background and not have anything to present to A user.

The HTML above assumes that's name of the script is myscript.asp and would reload the script (execute it) every S.

Copy the script file to your webserver so it is accessible within the Webserver namespace. From ' Now ', I assume that's in the ' webserver root directory, so it's 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 was pretty straight-forward if you follow the guideline with the NT provided Kit. Anyway, the following would 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 would run any application

Although its optional, I recommend putting both files in your 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, can provide any name for you.

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, the the "the" the Services applet in control Panel. Locate The new service, double-click it, and make sure it are 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 the 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

Course, you must does any appropriate changes to paths and names in order to fit your system setup and installations path S.

Close the Registry Editor.

Testing the SERVICE

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



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.