apache是目前廣泛使用的一種網絡服務器程序,不僅在unix/linux平臺上被大量使用,而且在windows平臺上也有許多站點放棄了iis而轉向apache。.net是微軟推出的功能強大的開發技術,其目標就是與java抗衡。asp.net非常適合于中小企業的web應用,其性能較asp3.0有了極大的提高。下面就介紹讓apache支持asp.net的辦法。
首先,必須要有windows環境和.net framework的支持。此外還建議安裝.net開發工具如.net framework sdk或者visualstudio.net。需要注意的是windows的版本應為2000、2003和xp。win9x系列不能安裝.net framework。然后需要安裝apache。應該使用win32平臺的apache,版本2.0以上。推薦使用2.0.51版本。
下面要下載并安裝apache環境下的asp.net模塊。下載地址:http://www.apache.org/dist/httpd/mod_aspdotnet/mod_aspdotnet-2.0.0.msi下載完成后雙擊打開,一路next即可安裝完成。
為了便于管理,我們在htdocs目錄下新建一個active目錄,專門存放.aspx文件。現在需要對httpd.conf文件作一定配置,在文件末尾添加:
#asp.net
loadmodule aspdotnet_module "modules/mod_aspdotnet.so"
addhandler asp.net asax ascx ashx asmx aspx axd config cs csproj /
licx rem resources resx soap vb vbproj vsdisco webinfo
<ifmodule mod_aspdotnet.cpp>
# mount the asp.net example application
aspnetmount /active "d:/program files/apache group/apache2/htdocs/active"
# map all requests for /active to the application files
alias /active "d:/program files/apache group/apache2/htdocs/active"
# allow asp.net scripts to be executed in the active example
<directory "d:/program files/apache group/apache2/htdocs/active">
options followsymlinks execcgi
order allow,deny
allow from all
directoryindex default.htm default.aspx
</directory>
# for all virtual asp.net webs, we need the aspnet_client files
# to serve the client-side helper scripts.
aliasmatch /aspnet_client/system_web/(/d+)_(/d+)_(/d+)_(/d+)/(.*) /
"c:/windows/microsoft.net/framework/v$1.$2.$3/asp.netclientfiles/$4"
"c:/windows/microsoft.net/framework/v*/asp.netclientfiles"> options followsymlinks order allow,deny allow from all </directory> </ifmodule> 其中d:/program files/apache group/apache2是apache的安裝目錄,應根據實際情況更改。現在可以在active目錄下放上asp.net探針。重啟apache之后,即可體驗apache下的asp.net了。 由于iis和apache下的asp.net都是運行在common language runtime(crl)的基礎上,因此apache環境下的asp.net程序的運行速度不會比在iis下慢。
新聞熱點
疑難解答
圖片精選