This article describes how to build an ASP.NET service on the Linux operating system. Before reading this article, readers must first determine that they have already installed the Linux operating system, Mono Runtime, if you need mod_mono, you need to complete the Apache installation and formulation. . For Mono installation and configuration, please refer to here.
XSP
XSP is a lightweight web server that is a pure .NET application written in 100% C # code. Of course, it is also a completely disclosed source code. XSP uses the class under the System.Web namespace to complete the ASP.NET's execution task, which can also be run on Windows (using Microsoft .NET Framework).
Relatively, XSP installation and formulation is relatively simple, its source package download address is: XSP web server 1.0
After downloading the package, execute: TAR ZXFV XSP-1.0.tar.gz to complete the decompression, generate a directory of XSP-1.0 in the current directory, after entering the directory, follow the order:
./figurationmakemake install
After completing the compile, enter the server subdirectory, you can see that there is an executable of Xsp.exe inside, this is the main program of XSP.
Next, you can test, there is a subdirectories called Test in the Directory of XSP-1.0. There are many ASPX files below. These are the test pages that come with the package. After entering the TEST directory, execute:
Mono /...xsp's directory ... / server / xsp.exe
Add see the following information: Adding applications' /:.'...Registering application: Host: any Port: any Virtual path: / Physical path: / Listening on port: 8080Listening on address: 0.0.0.0Root directory: / Hit Return To stop the server. The XSP has been listened to the 8080 port (the default is 8080 port), if you want to close the server, tap the vehicle button directly. Now you can open a web browser, enter directly:
http: // Your server address: 8080 /
If everything is normal, you can see the test home. The XSP also has some parameter options, and the list and description of these options can be seen when entering -help parameters. Here is a simple introduction:
- The port number of the XSP server listener is 8080 by default. If the XSP is the unique web server on your server, you can set it to 80.
-Adress sets the IP address of the XSP server listening, the default is 0.0.0.0, indicating that the request is accepted on all addresses.
--Root Sets the root directory of the website, the default is the current directory.
--appconfigfile Sets the XSP profile. The configuration file is a file in an XML format that allows these parameter options to configure.
--appconfigdir Sets the configuration file directory of XSP. If you write in a file (almost impossible), you can write the configuration information to multiple files, XSP reads all extensions in this directory all extensions .WebApp. Configuration file.
--Applications Set the XSP virtual directory. A XSP server can set multiple virtual directories, formats: virtual directory name: real path, if there are multiple words, the middle is separated by semicolons. --nOnStop knocked back to the vehicle without closing the server.
--Version Displays the version number of the XSP.
--verbose prints some additional information, mainly used to debug.
Apache Mono Module
The XSP described earlier is a lightweight server, then this should be a heavyweight (in fact, where is it, Apache is just a function of a proxy request, mainly to go to MOD_MONO Go), Apache Mono Module is an plug-in module for the Apache server that allows the Apache server to support the ASP.NET application.
MOD_MONO is downloaded at Apache Mono Module 1.0, and it is also:
./configurationMake make install
Once the compilation is complete, you can formulate the Apache server, find your apache configuration file, usually located in: /etc/httpd/conf/httpd.conf, open this file with the VI editor, plus:
LoadModule Mono_Module Modules / Libmod_Mono.so Alias / Virtual Directory Name "Real Path" MonoApplications "/ Virtual Directory Name: Real Path"
SetHandler Mono
If your MONO and XSP are not installed in the standard path, you need to add some extra parameters:
MonoExecutablePath Set up MONO's execution path
MonoServerPath sets the path to the mod-mono-server.exe file, note that this file is in the XSP package, so this is set to the path to XSP.
These parameters are typically set, and other parameter options are set to default.
Now you can restart the Apache server, find the path to your apachectl command, usually in / usr / sbin directory, then use:
Apachectl Restart
At this point you can open the browser to enter the server address and virtual directory to verify that it has been configured successfully.
Lu Yan 2004-7-7