Apache添加mod_aspdotnet.so支持ASP.NET配置指南
虽然IIS完美支持ASP.NET,自己常用Apache的缘故,要是让Apache也支持ASP.NET就好了,搜索一番,才知道,Apache组织早在2007年就开发出mod_aspdotnet了,不过随后就放弃更新了。。。
今天我们就来让Apache支持ASP.NET,
准备工作:
1.下载apache_2.0.55-win32-x86-no_ssl.msi(http://archive.apache.org/dist/httpd/binaries/win32/apache_2.0.55-win32-x86-no_ssl.msi);
2.下载mod_aspdotnet-2.0.0.msi(http://archive.apache.org/dist/httpd/mod_aspdotnet/mod_aspdotnet-2.0.0.msi),你也可到http://sourceforge.net/projects/mod-aspdotnet/去看看;
3.dotNetFramework v1.1或者v2.0(http://download.microsoft.com/download/7/b/9/7b90644d-1af0-42b9-b76d-a2770319a568/dotnetfx.exe);
安装配置:
1.首先安装dotNetFramework,这部很重要,因为我以前安装过略去;
2.安装Apache服务器,位置随你稍微配置一下,一路“next”;
3.安装mod_aspdotnet,安装过程中会先检测Apache的安装目录,确认正确后一路“next”;
4.进入Apache的modules目录,你会发现增加了mod_aspdotnet.so;
5.进入Apache的conf目录,打开httpd.conf配置文件,在尾部增加如下代码:
##################################################################
#ASP.NET
LoadModule aspdotnet_module "modules/mod_aspdotnet.so"
AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj
licx rem resources resx soap vb vbproj vsdisco webinfo
# Mount the ASP.NET example application假设网站文件位于f:/dotnet_document
AspNetMount /mytest "f:/dotnet_document"
# Map all requests for /active to the application files
Alias /mytest "f:/dotnet_document"
# Allow asp.net scripts to be executed in the active example
<Directory "f:/dotnet_document">
Options FollowSymlinks ExecCGI
order allow,deny
Allow from all
DirectoryIndex Default.htm Default.aspx index.aspx
</Directory>
# For all virtual ASP.NET webs, we need the aspnet_client files
# to serve the client-side helper scripts.
AliasMatch /aspnet_client/system_web/(d+)_(d+)_(d+)_(d+)/(.*)
"C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4"
<Directory "C:/Windows/Microsoft.NET/Framework/v*/ASP.NETClientFiles">
Options FollowSymlinks
order allow,deny
Allow from all
</Directory>
##################################################################
6.编写测试文件index.aspx存放到f:dotnet_document目录下,内容如下:
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml"; >
<head runat="server">
<title>Hello World! - mod_aspdotnet</title></head>
<body>
<form id="form1" runat="server">
<div>
<% Response.Write("<h1>Hello World!</h1>")%>
</div>
</form>
</body></html>
6.重启Apache服务器,打开浏览器输入http://127.0.0.1/mytest回车,看到”Hello World” 说明Apache的mod_aspdotnet模块工作正常了。