当前位置:首页 » 操作系统 » linux支持asp

linux支持asp

发布时间: 2023-05-24 02:17:28

linux服务器如何跑ASP项目

利用mono+xsp架构asp.net环境,可以跑ASP项目
1、 安装准备(系统安装忽略)
#安装完CentOS后,首先更新系统
yum -y update
#然后安装相关的编译器和必备的软件
yum -y install bison pkgconfig glib2-devel gettext make libpng-devel libjpeg-devel libtiff-devel libexif-devel giflib-devel libX11-devel freetype-devel fontconfig-devel cairo-devel libtiff libtiff-devel libjpeg libjpeg-devel giflib giflib-devel libpng libpng-devel libX11 libX11-devel freetype freetype-devel fontconfig fontconfig-devel libexif libexif-devel libXft-devel ghostscript-devel gnome-doc-utils unzip
2 、下载安装所需要的软件包
统一下载到/usr/local/src下
wget http://download.mono-project.com/sources/libgdiplus/libgdiplus-2.10.tar.bz2
wget http://download.mono-project.com/sources/mono/mono-2.10.8.tar.bz2
wget http://download.mono-project.com/sources/xsp/xsp-2.10.tar.bz2
wget http://download.mono-project.com/sources/mod_mono/mod_mono-2.10.tar.bz2
wget http://apache.fayea.com/apache-mirror//httpd/httpd-2.2.27.tar.gz
3.安装libgdiplus
libgdiplus是mono中的System.Drawing依赖的一个组件,用于显示web页面基本颜色等。
cd /usr/local/src
tar -xjvf libgdiplus-2.10.tar.bz2
cd libgdiplus-2.10
./configure --prefix=/usr/local
make
make install
4.安装mono
cd /usr/local/src
tar -xjvf mono-2.10.8.tar.bz2
cd mono-2.10.8
./configure --prefix=/usr/local
make
make install
Mono安装完成之后,可以用命令mono -V查看一下mono的安装情况,如果能够看到mono版本号等信息,说明Mono安装成功。
5.安装apache
cd /usr/local/src
tar -zxvf httpd-2.2.27.tar.gz
cd httpd-2.2.27
./configure --prefix=/usr/local/apache --enable-mods-shared=most
make
make install
6.安装mod_mono
cd /usr/local/src
tar -xjvf mod_mono-2.10.tar.bz2
cd mod_mono-2.10
./configure
make
make install
7.安装xsp
xsp就是mod-mono-server。
安装之前,先设置一下环境变量
vi /etc/profile #在最后加上下面这句
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
source /etc/profile 或者注销重新登陆一下
cd /usr/local/src
tar -xjvf xsp-2.10.2.tar.bz2
cd xsp-2.10.2
./configure --prefix=/usr/local
make
make install
8.配置apache
打开/usr/local/apache/conf文件夹中的httpd.conf,这个文件是apache的配置文件,在最后添加
Include /usr/local/apache/conf/mod_mono.conf
将以下#注释去掉
#ServerName www.example.com:80
在/usr/local/apache/htdocs文件夹中任意创建一个index.aspx文件,添加内容如下
<%@ Page Language="C#" %>
<html>
<head>
<title>hello world</title>
</head>
<body>
<%
for (int i=1; i<=7; i++)
{
Response.Write("<font size=" + i.ToString() + ">");
Response.Write("hello world");
Response.Write("</font><br />");
}
%>
</body>
</html>
当然,你也可以网络,去下载一个asp.net探针
重启apache
/usr/local/apache/bin/apachectl restart
通过浏览器访问http://IP/index.aspx,测试asp.net环境搭建是否成功,如果返回“hello world” 说明安装成功

② ASP.NET 如何调用linux下的Shell脚本程序

ASP.NET可以通过调用Process类来启动燃判Shell脚本程序。具体步骤如下:1. 引入命名空间System.Diagnostics。2. 创建ProcessStartInfo对象,设置它皮源改的FileName属性为Shell脚本的路径,设置Arguments属性为Shell脚本的参数。3. 创建Process对象,设置它的StartInfo属性为上一步创建的ProcessStartInfo对象。4. 调用Process对象的Start方裂樱法启动Shell脚本程序。示例代码:```using System.Diagnostics;string scriptPath = "/usr/local/bin/test.sh";string arguments = "arg1 arg2 arg3";ProcessStartInfo startInfo = new ProcessStartInfo{ FileName = "/bin/bash", Arguments = $"-c \"{scriptPath} {arguments}\"", RedirectStandardOutput = true};Process process = new Process{ StartInfo = startInfo};process.Start();string output = process.StandardOutput.ReadToEnd();process.WaitForExit();```上面的代码启动了名为test.sh的Shell脚本程序,它的完整路径为/usr/local/bin/test.sh。脚本有三个参数:arg1、arg2和arg3。程序执行完毕后,可以通过process.StandardOutput属性获得输出结果。注意在调用Start方法后必须等待程序运行完毕,才能读取输出结果。
热点内容
苹果系统搭建服务器的软件 发布:2025-04-22 16:36:29 浏览:13
房车配置怎么选择 发布:2025-04-22 16:22:14 浏览:492
编程猫gb 发布:2025-04-22 16:22:13 浏览:632
密码加密php 发布:2025-04-22 16:07:09 浏览:582
imac存储空间为什么这么小 发布:2025-04-22 15:45:30 浏览:223
上传时速是0 发布:2025-04-22 15:37:49 浏览:568
0基础的编程 发布:2025-04-22 15:37:09 浏览:205
vnc怎么查服务器ip 发布:2025-04-22 15:29:20 浏览:158
百度云ftp服务器 发布:2025-04-22 15:17:50 浏览:656
平板哪个配置最高 发布:2025-04-22 15:16:20 浏览:831