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

让Apache支持ASP.NET

[复制链接]
发表于 2006-12-17 18:33:15 | 显示全部楼层 |阅读模式
Apache是目前广泛使用的一种网络服务器程序,不仅在UNIX/LINUX平台上被大量使用,而且在Windows平台上也有许多站点放弃了IIS而转向Apache。
" I0 j: H% s- |8 J+ M.NET是微软推出的功能强大的开发技术,其目标就是与Java抗衡。ASP.NET非常适合于中小企业的Web应用,其性能较ASP3.0有了极大的提高。$ C7 p; l4 ^0 Z! y
下面就介绍让Apache支持ASP.NET的办法。& @) _/ n0 \$ A3 Y( m8 I9 I
8 q$ H- K* ]* X& F+ U5 X
     首先,必须要有Windows环境和.NET Framework的支持。此外还建议安装安装.NET开发工具如.NET Framework SDK或者VisualStudio.NET。需要注意的是Windows的版本应为2000、2003和XP。Win9X系列不能安装.NET Framework。
0 n! [7 X4 Z" w1 f% o3 c$ @; x2 Z
* Y& b" @8 [; Q1 l0 V; \     然后需要安装Apache。应该使用Win32平台的Apache,版本2.0以上。推荐使用2.0.51版本。下载地址:
; e' ]* U7 Y( X) Y; ~2 b% thttp://apache.freelamp.com/httpd/binaries/win32/apache_2.0.52-win32-x86-no_ssl.msi
1 C3 T% s6 l' e具体的安装过程请参阅其他文章,本文不再赘述。
" p- N+ E4 M2 ]1 |8 z% i% C7 C, |& q/ h
     下面要下载并安装Apache环境下的ASP.NET模块。下载地址:
" S; m  R' H, O/ y4 X- X; D& \/ Whttp://www.apache.org/dist/httpd/mod_aspdotnet/mod_aspdotnet-2.0.0.msi
  m/ r! e) I9 j下载完成后双击打开,一路Next即可安装完成。
3 N/ V* w4 m. B- \6 _0 E2 b! v7 Y! t- v' a& B; W) L
     为了便于管理,我们在htdocs目录下新建一个active目录,专门存放.aspx文件。现在需要对httpd.conf文件作一定配置,在文件末尾添加:
+ b: V4 J9 m: `1 M# Y0 Q8 W7 b' b, ?5 X& ^: {$ b+ V1 M
#asp.net
) ^6 ?4 Z3 p) X8 _8 k" ?LoadModule aspdotnet_module "modules/mod_aspdotnet.so"
# y( B7 D; I9 P. ^6 E4 l( l, m: J% A7 P, j: u
AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj \
% _8 N* V, t0 E' r2 ~7 `            licx rem resources resx soap vb vbproj vsdisco webinfo : A% g; b- b8 _6 D

+ g3 S. D2 Z( ~$ U1 D) E<IfModule mod_aspdotnet.cpp>' D. J! P  J( T% J
. P! y* g: d% n; D
  # Mount the ASP.NET example application
% K  c. u7 i; P& p& I  AspNetMount /active "D:/Program Files/Apache Group/Apache2/htdocs/active"
3 U5 C. ]3 A2 |$ x- z# `( I; P8 i
  # Map all requests for /active to the application files
- \  X* k- `1 |" @. b  Alias /active "D:/Program Files/Apache Group/Apache2/htdocs/active"
9 E% M1 b; c& \* J; n/ ~4 u& W  m* B" U/ v$ ]
  # Allow asp.net scripts to be executed in the active example
+ ^& g7 a4 _8 q! ~5 R) p3 k# r  <Directory "D:/Program Files/Apache Group/Apache2/htdocs/active">7 o, R& ]6 n+ D
    Options FollowSymlinks ExecCGI
- o% s1 E) b9 E7 M- r% C3 u    Order allow,deny+ }/ ?  R. N: O# g3 N6 e( i
    Allow from all
  u  \5 b- B0 S6 L! `    DirectoryIndex Default.htm Default.aspx
$ Y& E4 }' z$ ~. x, S( X; D. s  </Directory>
0 t4 p5 D0 b) G/ H+ F1 x
2 `- k2 ~2 Z! W0 F- }  # For all virtual ASP.NET webs, we need the aspnet_client files
6 u/ m* k# V; f- w+ I. V  # to serve the client-side helper scripts.
9 B. P+ O8 @3 v  f* N% _  AliasMatch /aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*) \6 a2 a+ y5 A9 S& L
      "C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4"' y+ ~0 Y3 P) Y6 w% l+ f2 h
  <Directory \% J! [5 h& R# K- C  N# p
      "C:/Windows/Microsoft.NET/Framework/v*/ASP.NETClientFiles">" C+ }3 f: f  }6 \+ J* l) Y. ]
    Options FollowSymlinks
4 p3 B! G/ z" t    Order allow,deny( a* N- u; B( Y) d. T- }1 P' d( N9 f
    Allow from all1 L2 x5 |$ }3 J" C) ^
  </Directory>
' d# N0 I3 m) \0 x% \% n
) a& q9 ?- R0 d& I. C% K</IfModule>* W" S8 ?8 T2 E) M0 _6 ?1 }

4 n2 k8 e& ]4 `5 N$ D0 _     其中D:/Program Files/Apache Group/Apache2是Apache的安装目录,应根据实际情况更改。
# d. v6 a$ e: s& D1 W" ?现在可以在active目录下放上ASP.NET探针。重启Apache之后,即可体验Apache下的ASP.NET了。
' W$ s. f3 S4 W* }2 x9 y
& E0 [: ^! F( I     由于IIS和Apache下的ASP.NET都是运行在Common Language Runtime(CRL)的基础上,因此Apache环境下的ASP.NET程序的运行速度不会比在IIS下慢。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-1-1 11:32 , Processed in 0.117361 second(s), 14 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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