(Double-click main. box has never responded. depressed for a long time... later I realized that my problem was that port 80 was occupied. the problem was solved immediately after thunder was shut down. haha .. another solution is to change the port number ..)
What is netbox?
Netbox is a development environment and running platform that uses scripting language for Application Software Development and release. netbox allows you to use scripting languages (such as VBScript and JavaScript) create stable and efficient application software.
Netbox provides high-performance HTTP server objects that are completely unrelated to the operating system, and fully supports ASP
Server scripting technology allows you to easily deploy mature ASP applications to various operating environments through netbox. Because it is no longer limited to operating system restrictions
Windows XP provides performance support that exceeds Windows 2000 advance server.
Netbox2.8 instructions for use:
After downloading, follow these steps to use netbox to view your ASP program.
1. install the software as usual.
2. Create a new directory (whatever the directory name is). Create a file under the directory named main. box. The icon will change:
The content of this file is as follows:
Dim httpd
Shell. Service. runservice "nbweb", "netbox web server", "netbox HTTP Server Sample"
Sub onservicestart ()
Set httpd = Createobject ("netbox. httpserver ")
If httpd. Create ("", 83) = 0 then
Set host = httpd. addhost ("","")
Host. enablescript = true
Host. adddefault "1.asp"
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
3. Create a 1.aspin in the directory. The content is as follows:
<% = "Search
"%>
4. Double-click main. Box. At this time, you can see in the taskbar:
5. Enter the following in the browser address:
Http: // localhost: 83/1. asp
The above is the process of creating a Web server in netbox2.8, which has many advantages. You can create multiple Web servers. You only need to open main. box before using it.
As usual. It also makes it possible to debug ASP programs without installing IIS. For example, when you are in an Internet cafe, I say it is a good thing. It is very practical for me, and I have many ASP programs
You can use IIS to manually change to the "default website" to run normally. With this, it saves me a lot of trouble! As to whether it has any other problems, I just tested it a little and didn't have a specific test. It's hard to say!
For the second step above, why is the program written in that way? Here I reference the content of the help document and you will understand that for debugging, there is no need to understand why it is like this. The key is that it can be like this. Reference content:
One of netbox's major functions is built-in support for httpserver and ASP. The following describes how to create a web server running as a service.
Step 1: create a web server
Because netbox provides an httpserver object, it is naturally implemented by the httpserver object to create a new httpserver and start, stop, and exit. The main. Box code is relatively simple:
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
In the code above, create a new httpserver, and then create a server on port 80 of all local addresses. If the server is successfully created, start the server, wait for the user to press enter on the console to stop and shut down the server.
Run this program. If no other Web servers are installed in the current system, the program will display the console and wait for the carriage return. Otherwise, the program will exit directly. Oh, our first program is very poor. It doesn't matter. Let's take a step.
If the program runs successfully, you can access it in the browser. Because the server is installed on the local machine, open the browser and enter "http: // localhost/" in the address bar. The result is displayed, but it looks pretty bad:
418 host not found
No matter what you want to access, it will only be the result. Such results obviously cannot meet the requirements, so we need to improve our web server.
Step 2: Add a VM
The reason why the previously created Server Always Returns forbidden access is that no host information is set up for the server. So we modify the code and use the addhost method to add the host information:
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
Create a sub-directory in the netbox execution directory
Wwwroot, and then copy some web pages. Let's take a look at the effect. Run the program and access "http: // localhost/" again. The result is still "403 ".
Forbidden ". Access wwwroot again
Existing files in the directory. Haha, the correct content is displayed. Therefore, the host has been created, but the default file name is not provided to the host.
Step 3: Add default files
To let the host know the files returned to the user when the user accesses the directory, use the adddefault method to add the default file name to the host. The modification code is as follows:
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
When we access "http: // localhost/", we will find that the default page content is displayed instead of displaying Access prohibited. If the given default file does not exist, the system returns "404 file not found ".
Step 4: Support server scripts
The Web server created in the preceding steps is a pure static file server and cannot execute server script programs.
The server can understand the server script program and needs to modify enablescript.
Attribute. To enable the server to use the script program as the default file, you also need to add a default file. The new Code is as follows:
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
Next, we can create our ASP script program in the wwwroot directory and create test. asp:
<% Response. Write "hello" %>
Netbox also supports server box programs. Create test. Box in the wwwroot directory:
Response. Write "hello"
Step 5: run as a service
So far, there has been a relatively complete Web server program. Next we need to rewrite this server as a system service program and install it as a system service, easy to run and maintain. To rewrite a service program, you must use a service object.
The following is a complete Web Service Code. For more information about service objects, see the manual.
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
Summary
To implement a complete Web service program, you need httpserver, httpserverhost, and service
Three objects are supported. httpserver is responsible for setting up the server and controlling the running status of the server. httpserverhost is responsible for setting up the host information and service
Complete the operations related to the service program.
Note the following during usage:
If httpd. Create ("", 83) = 0 then
Why is it 83? Because there is a conflict when I use 80, netbox2.8 does not respond after it is opened, so you are also advised to change the port.