找回密码
 注册
搜索
查看: 5715|回复: 0

让Apache支持ASP.NET

[复制链接]
发表于 2006-12-17 18:33:15 | 显示全部楼层 |阅读模式
Apache是目前广泛使用的一种网络服务器程序,不仅在UNIX/LINUX平台上被大量使用,而且在Windows平台上也有许多站点放弃了IIS而转向Apache。0 H/ ~/ M8 m2 n0 p4 D* L8 h
.NET是微软推出的功能强大的开发技术,其目标就是与Java抗衡。ASP.NET非常适合于中小企业的Web应用,其性能较ASP3.0有了极大的提高。
3 c2 X% T4 b8 ~7 x( ]下面就介绍让Apache支持ASP.NET的办法。
8 s& s) k/ Q+ F$ r! ?
7 a8 Y4 Z6 s# y5 W7 w" t# ?8 Z4 T3 Q     首先,必须要有Windows环境和.NET Framework的支持。此外还建议安装安装.NET开发工具如.NET Framework SDK或者VisualStudio.NET。需要注意的是Windows的版本应为2000、2003和XP。Win9X系列不能安装.NET Framework。2 ]8 T" {1 v1 j7 @
" v; ~$ u" @7 G% B( W% ?
     然后需要安装Apache。应该使用Win32平台的Apache,版本2.0以上。推荐使用2.0.51版本。下载地址:
0 b! \7 q' W' |: S' I3 Q+ xhttp://apache.freelamp.com/httpd/binaries/win32/apache_2.0.52-win32-x86-no_ssl.msi
* e* u: E  E8 R) {8 R具体的安装过程请参阅其他文章,本文不再赘述。/ i* R, f: u& p1 A1 q+ w
& G1 T( ~' T( o/ H/ ?0 s
     下面要下载并安装Apache环境下的ASP.NET模块。下载地址:
9 v1 e3 w! `+ N" ]http://www.apache.org/dist/httpd/mod_aspdotnet/mod_aspdotnet-2.0.0.msi% g5 h9 b" T) Z
下载完成后双击打开,一路Next即可安装完成。' a- Q/ F, b0 l8 E+ N5 n
& b" Z5 l$ ~* }' T% l) i
     为了便于管理,我们在htdocs目录下新建一个active目录,专门存放.aspx文件。现在需要对httpd.conf文件作一定配置,在文件末尾添加:4 N- r  ?# [* \% S
; }1 q& N+ i" y: W. z/ G2 V
#asp.net$ ]! R  R3 ?  q
LoadModule aspdotnet_module "modules/mod_aspdotnet.so"
$ e" X; Q: E7 K/ f" T5 q; t! q! W. W3 y" z; t% M: K1 I
AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj \* o& r5 {3 [& Z" A+ v- |" l
            licx rem resources resx soap vb vbproj vsdisco webinfo 7 S( b2 @, j$ i0 w4 }5 F

% U6 W+ u, y$ l5 t' w<IfModule mod_aspdotnet.cpp>
' y2 Z9 C9 B6 a* u: m* _, R/ {+ ~8 [1 X& U  F* @
  # Mount the ASP.NET example application
9 o( [, d: L! E2 ~1 M" j  AspNetMount /active "D:/Program Files/Apache Group/Apache2/htdocs/active"( C& Q/ w8 s+ o$ ^) B: ~
& Q( ^* u* i8 ~, @
  # Map all requests for /active to the application files
! l1 e  y3 Q; I7 Z1 `5 {; a2 o  Alias /active "D:/Program Files/Apache Group/Apache2/htdocs/active"* E. t7 r* l6 p  i( _2 B' ]
( F, `: G' X/ T! b/ h3 m
  # Allow asp.net scripts to be executed in the active example
% J2 n) t/ E* f. N6 V  <Directory "D:/Program Files/Apache Group/Apache2/htdocs/active">
) L! `- T7 R% t$ ~3 `3 g- I6 w    Options FollowSymlinks ExecCGI  W8 R! q- }% h/ ~+ C/ B
    Order allow,deny6 ~3 V9 r( J* x7 W' O& }8 A) ?
    Allow from all7 e& C5 j' c- F$ J8 f
    DirectoryIndex Default.htm Default.aspx! x7 M) Y  u  r% v0 z7 P6 ^
  </Directory>& G) [6 R$ Z0 ?
5 G2 Z( l( B+ {3 b
  # For all virtual ASP.NET webs, we need the aspnet_client files
( t" Q$ U+ e, J% ^$ X  # to serve the client-side helper scripts.
8 z$ c- W! O/ L: _, M: m# ~' T  AliasMatch /aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*) \
* ^- ~3 a1 d& d9 W. I" E  M  v      "C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4"5 s& [' W! B! `) k
  <Directory \
. i/ z1 {/ O. |      "C:/Windows/Microsoft.NET/Framework/v*/ASP.NETClientFiles">
: o8 i9 Z. `4 \1 }2 I$ L4 P: b9 |    Options FollowSymlinks
7 m+ M- r  }. L+ ^+ C    Order allow,deny
& a, c+ J# R# E7 J4 F' R! h5 ~    Allow from all0 N7 x* \) A2 b' F. N
  </Directory>
# |" r+ k" B# J, a: ?& _9 f5 p5 \0 ^8 D( V1 C/ s. S  {( \, A
</IfModule># w+ l' M8 Y. P3 L& y/ B# u$ p
# a+ g9 W, o/ U9 t% @! f
     其中D:/Program Files/Apache Group/Apache2是Apache的安装目录,应根据实际情况更改。
0 l+ D  c" l& N- Z( j$ g现在可以在active目录下放上ASP.NET探针。重启Apache之后,即可体验Apache下的ASP.NET了。& M1 `0 X; Y- N" m4 {# V; g: `1 P
3 b6 ]/ ?1 p" ^0 R% H/ s2 I
     由于IIS和Apache下的ASP.NET都是运行在Common Language Runtime(CRL)的基础上,因此Apache环境下的ASP.NET程序的运行速度不会比在IIS下慢。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|宁德市腾云网络科技有限公司 ( 闽ICP备2022007940号-5|闽公网安备 35092202000206号 )

GMT+8, 2026-1-17 18:23 , Processed in 0.018523 second(s), 14 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表