http://www.mono-project.com/docs/getting-started/install/linux/#centos-7-fedora-19-and-later-and-derivatives
$ su
$ yum install yum-utils
$ rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"
$ yum-config-manager --add-repo http://download.mono-project.com/repo/centos/
$ yum install mono-core
2.测试 Mono
$ mono -V
3.安装 XSP + Apache2
$ yum install xsp
# 如果不想直接用 XSP, 可多安装 Apache2
$ yum install httpd apache2-mod_mono
4. 为 XSP 准备一个文件夹做根目录 DocumentRoot
$ su username
$ cd /home/username
$ mkdir www
5. 运行 XSP 或 Apache2
$ su root
$ cd /home/username/www
$ xsp4 --port=80
$ cd /home/username/www
$ xsp4 --port=80
或
$ systemctl restart httpd
6. 测试
# 用 XSP 的话
$ su username
$ cd /home/username/www
$ systemctl restart httpd
6. 测试
# 用 XSP 的话
$ su username
$ cd /home/username/www
或
# 用 Apache2 的话
$ su root
$ cd /var/www/html
# 用 Apache2 的话
$ su root
$ cd /var/www/html
$ gedit 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>
<%@ 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>
$ wget http://localhost/index.aspx
7. Service Unavailable (503)
# 在 /etc/httpd/logs/error_log 出现
# Cannot open assembly '/usr/lib/mono/2.0/mod-mono-server2.exe': No such file or directory.
解决方法
$ su
$ gedit /etc/httpd/conf/httpd.conf
MonoServerPath /usr/bin/mod-mono-server4
IncludeOptional conf.d/*.conf
$ gedit /etc/sysconfig/selinux
SELINUX=disabled
$ systemctl restart httpd
没有评论:
发表评论