Simple Web Server
ver1.20
Summary
It's a simple web server that runs single-threaded with no configuration.
All you have to do is place the HTML or image files you want to publish.
We developed it with the aim of making a web server that works without thinking about anything else.
CGI also works. (You'll need to install the interpreter for each language)
CGI can be run as Perl(.pl), PHP(.php), Ruby(.rb), Python(.py) or
It is a .exe file made by C, C++, C# language etc.
CGI does not work as a module.
It does not create a log file or a temporary file.
We don't support authentication.
It's the best server for people who don't want to get involved in installing and configuring apache and IIS.
It's also useful when creating web pages that use jQuery UI, jQuery Mobile, etc.
(e.g. just copy this executable file to the demo folder and run it)
Precautions when using the site
Please feel free to use it for commercial or non-commercial purposes. You can also embed it in other applications.
However, we do not take any responsibility for the normalcy, defects, or inadequacies of this application.
Verified environment
NetFramework 4.0 or later on Windows 7,8.1
Changes in ver. 1.10
NetFramework4.0 from .NetFramework2.0.
Added quite a bit of mime type.
How to install and run
Unzip the downloaded file, right click on tanjunwsv.exe and run it with administrative rights.
Nothing changes on the screen, but it's working behind the scenes.
In your browser: http://localhost/readme.html
and you can see this ReadMe.
Place the file you want to deliver in the same folder as the executable file.
The subfolder name becomes the URL path as it is.
Basically, there is no way to terminate it, but if you really want to do so, you can do so by using in Task Manager.
(There are only two settings that can be customized)
If you want to change the public folder, you can use
as a Windows environment variable.
DOCUMENT_ROOT
and set the absolute path to it.
If you want to change the port (default value is 80)
SERVER_PORT
and set the port number by creating a
(Other notes)
CGI files do not have to have a .cgi extension
In the case of .cgi, the first line is parsed and made to work.
The path in the first line can be written in the same way as in Linux.
Example:
#!/usr/bin/perl
In the above case, execute perl, where the perl.exe folder is registered in the environment variable PATH
.
You need to.
In the case of PHP, I prefer php-cgi.exe to php.exe automatically.
CGI execution starts the process and returns the standard output to the client at once.
When creating a CGI in C# or other languages, you can use environment variables (such as GET) or standard input (POST) to create a
It can be created. In C#, for example, it looks like this. (You are responsible for building your own.)
(Reference setting to System.Web required)
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace test
{
class Program
{
static void Main(string[] args)
{
string method = Environment.GetEnvironmentVariable("REQUEST_METHOD");
string query="";
if (method == "GET")
{
query = Environment.GetEnvironmentVariable("QUERY_STRING");
}
if (method == "POST")
{
query = Console.In.ReadToEnd();
Encoding encoding = Encoding.GetEncoding("Shift-JIS");
query = System.Web.HttpUtility.UrlDecode(query, encoding);
}
Console.WriteLine("Content-Type: text/html");
Console.WriteLine("");
Console.WriteLine("");
Console.WriteLine("");
Console.WriteLine("");
Console.WriteLine("");
Console.WriteLine("METHOD="+method + "
");
Console.WriteLine("QUERY="+query+"
");
Console.WriteLine("");
Console.WriteLine("");
}
}
}
Finally
It also works with Java class files and jar files, but the servlet and JSP are not the same.
It doesn't work and I won't explain it because it would be confusing.
ASP and ASP.net don't work either, so it may not make sense to use C#.
There are not many samples of CGI other than scripting languages in the world, and
To prevent beginners from misunderstanding that they can't make CGI with the compiler language, here is a sample of C#.
Personally, I don't think it's bad to make CGI with C#.