让Apache支持ASP.NET-Apache,ASP.NET

来源:互联网 发布:阿里云大厦 百度图片 编辑:程序博客网 时间:2024/06/07 22:56
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
.Pqv405{display:none;}

Apache是目前广泛使用的一种网络服务器程序,不仅在UNIX/LINUX平台上被大量使用,而且在Windows平台上也有许多站点放弃了IIS而转向Apache。.NET是微软推出的功能强大的开发技术,其目标就是与Java抗衡。ASP.NET非常适合于中小企业的Web应用,其性能较ASP3.0有了极大的提高。下面就介绍让Apache支持ASP.NET的办法。

首先,必须要有Windows环境和.NETFramework的支持。此外还建议安装.NET开发工具如.NETFrameworkSDK或者VisualStudio.NET。需要注意的是Windows的版本应为2000、2003和XP。Win9X系列不能安装.NETFramework。然后需要安装Apache。应该使用Win32平台的Apache,版本2.0以上。推荐使用2.0.51版本。

下面要下载并安装Apache环境下的ASP.NET模块。下载地址:下载完成后双击打开,一路Next即可安装完成。

为了便于管理,我们在htdocs目录下新建一个active目录,专门存放.ASPx文件。现在需要对httpd.conf文件作一定配置,在文件末尾添加:

#ASP.NET

LoadModuleASPdotNET_module"modules/mod_ASPdotNET.so"

AddHandlerASP.NETasaxascxashxasmxASPxaxdconfigcscsproj/

licxremresourcesresxsoapvbvbprojvsdiscowebinfo

<IfModulemod_ASPdotNET.cpp>

#MounttheASP.NETexampleapplication

ASPNETMount/active"D:/ProgramFiles/ApacheGroup/Apache2/htdocs/active"

#Mapallrequestsfor/activetotheapplicationfiles

Alias/active"D:/ProgramFiles/ApacheGroup/Apache2/htdocs/active"

#AllowASP.NETscriptstobeexecutedintheactiveexample

<Directory"D:/ProgramFiles/ApacheGroup/Apache2/htdocs/active">


OptionsFollowSymlinksExecCGI

Orderallow,deny

Allowfromall

DirectoryIndexDefault.htmDefault.ASPx

</Directory>

#ForallvirtualASP.NETwebs,weneedtheASPNET_clientfiles

#toservetheclient-sidehelperscripts.

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">

"C:/Windows/Microsoft.NET/Framework/v*/ASP.NETClientFiles">

OptionsFollowSymlinks

Orderallow,deny

Allowfromall

</Directory>

</IfModule>

其中D:/ProgramFiles/ApacheGroup/Apache2是Apache的安装目录,应根据实际情况更改。现在可以在active目录下放上ASP.NET探针。重启Apache之后,即可体验Apache下的ASP.NET了。

由于IIS和Apache下的ASP.NET都是运行在CommonLanguageRuntime(CRL)的基础上,因此Apache环境下的ASP.NET程序的运行速度不会比在IIS下慢。

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击