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

让Apache支持ASP.NET

[复制链接]
发表于 2006-12-17 18:33:15 | 显示全部楼层 |阅读模式
Apache是目前广泛使用的一种网络服务器程序,不仅在UNIX/LINUX平台上被大量使用,而且在Windows平台上也有许多站点放弃了IIS而转向Apache。, C+ t% O+ g$ D3 x
.NET是微软推出的功能强大的开发技术,其目标就是与Java抗衡。ASP.NET非常适合于中小企业的Web应用,其性能较ASP3.0有了极大的提高。2 M* L4 b) a1 Z* ]; ^; H$ j+ M
下面就介绍让Apache支持ASP.NET的办法。5 g5 L* f* {( r1 h3 X/ {* ?

3 p5 a* ?8 P& `: ?  j     首先,必须要有Windows环境和.NET Framework的支持。此外还建议安装安装.NET开发工具如.NET Framework SDK或者VisualStudio.NET。需要注意的是Windows的版本应为2000、2003和XP。Win9X系列不能安装.NET Framework。; E8 N3 b1 T* g; d
4 Z% O, S! l0 Q9 R  W6 \* [# [
     然后需要安装Apache。应该使用Win32平台的Apache,版本2.0以上。推荐使用2.0.51版本。下载地址:) j8 L8 E6 F4 _1 [
http://apache.freelamp.com/httpd/binaries/win32/apache_2.0.52-win32-x86-no_ssl.msi3 O) W; l9 P% ]* H* j$ ?0 G
具体的安装过程请参阅其他文章,本文不再赘述。/ W) y7 a& K* V. V

6 F$ @3 K7 d+ ?7 W+ S     下面要下载并安装Apache环境下的ASP.NET模块。下载地址:6 ]& Z: ^- R" ?7 p$ G+ ?, a
http://www.apache.org/dist/httpd/mod_aspdotnet/mod_aspdotnet-2.0.0.msi/ s0 \( ~, y& B$ v" z
下载完成后双击打开,一路Next即可安装完成。
2 w+ w+ W  s4 w! Q  f) e9 {2 I- z! X+ X, E9 }2 y! q
     为了便于管理,我们在htdocs目录下新建一个active目录,专门存放.aspx文件。现在需要对httpd.conf文件作一定配置,在文件末尾添加:0 e; ]- u, U$ v! o$ W$ s
  D$ u  ?4 E4 u' w
#asp.net. i6 Z+ @2 ~! G! N# o6 }! P( C3 p
LoadModule aspdotnet_module "modules/mod_aspdotnet.so"
2 P' o1 M0 Y  D& E& c0 K/ \# T9 h
AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj \+ `9 v3 R# A* F. _/ {, W0 E
            licx rem resources resx soap vb vbproj vsdisco webinfo
! \2 q" w4 R9 ?$ c1 Y, V* n
/ _; N( g3 a! R) c- }<IfModule mod_aspdotnet.cpp>
$ `- _6 f' ^! d3 C; U: {6 \0 e  b4 a! L6 U5 B1 n1 B" A$ z
  # Mount the ASP.NET example application
8 J; T% _* j: A* t1 m  AspNetMount /active "D:/Program Files/Apache Group/Apache2/htdocs/active"
/ M& w1 G: V! m/ @4 ^( `" u" R: ^6 S9 e* ^7 n8 G& O  Y
  # Map all requests for /active to the application files
% P$ y- E: R5 N' n: S+ G  Alias /active "D:/Program Files/Apache Group/Apache2/htdocs/active"6 N" O3 |5 J; c# D2 }# a
: C, y% r1 o' t3 L
  # Allow asp.net scripts to be executed in the active example
! ]! m. f$ N) K8 }6 q. x& h  <Directory "D:/Program Files/Apache Group/Apache2/htdocs/active">
1 E/ Q3 A, W: F3 g    Options FollowSymlinks ExecCGI/ M% ~8 e, v. v- I: X3 N
    Order allow,deny
- U* P$ T8 M' O0 }# d    Allow from all
9 `( b& D; y- P: G2 b; k7 X    DirectoryIndex Default.htm Default.aspx% @4 b) {% c' t
  </Directory>; P- l7 Y( S5 h3 t3 Q) s, G
2 h9 C- R/ }  L# `2 q: y
  # For all virtual ASP.NET webs, we need the aspnet_client files 2 i, W: v4 l% h5 H0 h' H
  # to serve the client-side helper scripts.$ \0 u8 l" n! S
  AliasMatch /aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*) \) e/ i( J3 Z1 w3 G4 B0 a; _- o3 g( |" H
      "C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4"
' H% U/ E+ V3 t- n, i  <Directory \0 J9 M) m; I; N2 j
      "C:/Windows/Microsoft.NET/Framework/v*/ASP.NETClientFiles">
/ p6 p0 T, o; n& t1 ]    Options FollowSymlinks
& G. q, Y9 c1 I# k# _# K" s    Order allow,deny
8 f- D& x9 ~9 k8 w9 }, o; F    Allow from all, ~0 l) e4 @: @$ C7 L! m1 c
  </Directory>, \+ a; D% L$ {; E4 @% H/ Y# g
  S* T5 M& y" @. g) X; n' W/ d
</IfModule>
: ?9 @7 |" n+ E. k  g
- R  i5 H! c' P6 |+ e/ U     其中D:/Program Files/Apache Group/Apache2是Apache的安装目录,应根据实际情况更改。
- \* D5 j/ n( U现在可以在active目录下放上ASP.NET探针。重启Apache之后,即可体验Apache下的ASP.NET了。5 I) l" j& L! P% L& u

* i7 N" `) v- O9 z  x     由于IIS和Apache下的ASP.NET都是运行在Common Language Runtime(CRL)的基础上,因此Apache环境下的ASP.NET程序的运行速度不会比在IIS下慢。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-11-24 12:03 , Processed in 0.015891 second(s), 14 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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