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

让Apache支持ASP.NET

[复制链接]
发表于 2006-12-17 18:33:15 | 显示全部楼层 |阅读模式
Apache是目前广泛使用的一种网络服务器程序,不仅在UNIX/LINUX平台上被大量使用,而且在Windows平台上也有许多站点放弃了IIS而转向Apache。
3 u" M; g! J! h, F.NET是微软推出的功能强大的开发技术,其目标就是与Java抗衡。ASP.NET非常适合于中小企业的Web应用,其性能较ASP3.0有了极大的提高。
, ]& b+ |1 D8 t# O% N: g' m下面就介绍让Apache支持ASP.NET的办法。
+ A5 \( l3 R& l( M! K4 G5 {0 i& i6 H8 y( W' z4 f
     首先,必须要有Windows环境和.NET Framework的支持。此外还建议安装安装.NET开发工具如.NET Framework SDK或者VisualStudio.NET。需要注意的是Windows的版本应为2000、2003和XP。Win9X系列不能安装.NET Framework。2 `5 ~1 ~3 t! Q

9 K! b3 s- y0 ~& G7 g9 ^/ {* c     然后需要安装Apache。应该使用Win32平台的Apache,版本2.0以上。推荐使用2.0.51版本。下载地址:
% R- ]; R3 i# K' u1 ~0 ~http://apache.freelamp.com/httpd/binaries/win32/apache_2.0.52-win32-x86-no_ssl.msi
( D* t2 z4 X/ u& E3 T# \具体的安装过程请参阅其他文章,本文不再赘述。& ~8 U$ w" n- K
. g. ~* ]: O* h2 u
     下面要下载并安装Apache环境下的ASP.NET模块。下载地址:
6 B% O- z$ x; n. Q% Uhttp://www.apache.org/dist/httpd/mod_aspdotnet/mod_aspdotnet-2.0.0.msi- j4 R5 ]! x) \3 R0 W
下载完成后双击打开,一路Next即可安装完成。6 n( a9 i5 j$ M) V5 X- k% ^; c6 V' f- W

  D) D6 x; M7 e! P     为了便于管理,我们在htdocs目录下新建一个active目录,专门存放.aspx文件。现在需要对httpd.conf文件作一定配置,在文件末尾添加:
* e+ r! y% i: b, F, N3 _% A2 O9 p  U, K. J* H# C
#asp.net
! `! R) A8 G0 @7 oLoadModule aspdotnet_module "modules/mod_aspdotnet.so"
& g3 [2 E% `2 Z' _) |2 ~! y+ Y, |
# N2 m" j& C! ~( B# UAddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj \! x: S4 ^- g7 \. n/ a
            licx rem resources resx soap vb vbproj vsdisco webinfo
! q( y3 T8 F! m# I) w+ p8 @$ X/ J0 j* c$ p% L
<IfModule mod_aspdotnet.cpp>  W# E0 b# P' h4 b1 @( l
% ^6 ~4 {3 `% G3 W1 _
  # Mount the ASP.NET example application
4 G) w" H  a$ S) g. ~( l: d  AspNetMount /active "D:/Program Files/Apache Group/Apache2/htdocs/active"8 ^: }; N6 N% ~+ e, @& t4 q+ A3 K
7 r' ?% ^$ r# m" ]
  # Map all requests for /active to the application files3 a0 y4 e' K' a8 Z) d, R
  Alias /active "D:/Program Files/Apache Group/Apache2/htdocs/active"
, g* y+ c  D0 @& Q/ E
, T" t4 y% c9 R  # Allow asp.net scripts to be executed in the active example
9 H0 J- C" o9 d2 w  <Directory "D:/Program Files/Apache Group/Apache2/htdocs/active">
$ C% ?4 w1 Z# R1 w    Options FollowSymlinks ExecCGI( q8 F. [( A: L  Q8 _
    Order allow,deny' i& _5 R7 j0 b4 j9 U" \
    Allow from all
8 e+ w9 S# e* d2 `  s, r    DirectoryIndex Default.htm Default.aspx" ]' |' d/ {# d1 I2 M0 f
  </Directory>
& Z" H3 ^1 ~! W  q. `1 `4 V9 l- M# z1 ^2 z; l( B- K
  # For all virtual ASP.NET webs, we need the aspnet_client files
% X( Z* x7 l- g; n4 _/ y9 h  # to serve the client-side helper scripts.7 q. U& |( {# W. X1 I; u& u
  AliasMatch /aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*) \
9 N# R; e, j6 d      "C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4". H, M; e3 P- B" ^' T; K' z
  <Directory \$ p6 f' G6 r% D/ M! N: ?; ]
      "C:/Windows/Microsoft.NET/Framework/v*/ASP.NETClientFiles">* e: R8 R$ C: h) [7 G2 R/ G8 e
    Options FollowSymlinks% B5 H8 l! r8 {! N8 X
    Order allow,deny
+ U0 @, m! A: n& U$ t) J; J9 y    Allow from all
8 G0 ]; V+ q3 \3 M( m; ?7 Z$ D' b6 }# E  </Directory>$ v9 H3 H2 M) [; g% c

  P( K* U6 ]7 ~1 S</IfModule>' A) c$ O. ~( U. o6 O" h
$ R, @4 b: _# V0 Z
     其中D:/Program Files/Apache Group/Apache2是Apache的安装目录,应根据实际情况更改。
6 k4 u$ ^4 S; k: y) k/ ?& _  U( z- s现在可以在active目录下放上ASP.NET探针。重启Apache之后,即可体验Apache下的ASP.NET了。
! v4 S# X, L4 n# h) C* ?, z( X
: t) a" e( |4 h. N- s% P1 j; Z     由于IIS和Apache下的ASP.NET都是运行在Common Language Runtime(CRL)的基础上,因此Apache环境下的ASP.NET程序的运行速度不会比在IIS下慢。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-2-1 23:30 , Processed in 0.018343 second(s), 14 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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