用 Apache 發布 ASP.NET 網站

來源:互聯網
上載者:User

標籤:exe   .net   virt   class   deny   ase   asa   link   ecc   

由於伺服器需要發布 JSP 、PHP、ASP.NET 幾種網站進行測試,Apache 肯定是支援 JSP  和 PHP 。鑒於 Apache 的開放精神 ,ASP.Net 應該也是支援的,於是乎 Google之。配置步驟如下:

1.下載 ASP.NET 解析模組(mod_aspdotnet )

:http://sourceforge.net/projects/mod-aspdotnet/ ,直接安裝。在...\apache\modules目錄下會出現一個名為 mod_aspdotnet.so 的模組。

2.配置 Apache 使其支援此模組

建立設定檔 mod_aspdotnet.conf, 儲存在 ...\apache\conf 目錄下,其內容如下:

 

[plain] view plain copy 
  1. # ASP.NET Support  
  2. LoadModule aspdotnet_module modules/mod_aspdotnet.so  
  3.   
  4. AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj licx rem resources resx soap vb vbproj vsdisco webinfo   
  5.   
  6. <IfModule mod_aspdotnet.cpp>  
  7.     # Mount the ASP.NET example application  
  8.     AspNetMount /aspnet "f:/demo"  
  9.     # Map all requests for /active to the application files  
  10.     Alias /aspnet "f:/demo"  
  11.   
  12.     # Allow asp.net scripts to be executed in the active example  
  13.     <Directory "f:/demo">  
  14.         Options FollowSymlinks ExecCGI  
  15.         Order allow,deny  
  16.         Allow from all  
  17.         DirectoryIndex index.aspx Default.aspx index.html  
  18.     </Directory>  
  19.   
  20.     # For all virtual ASP.NET webs, we need the aspnet_client files  
  21.     # to serve the client-side helper scripts.  
  22.     AliasMatch /aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*) \"C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4"  
  23.     <Directory "C:/Windows/Microsoft.NET/Framework/v*/ASP.NETClientFiles">  
  24.         Options FollowSymlinks  
  25.         Order allow,deny  
  26.         Allow from all  
  27.     </Directory>  
  28. </IfModule>  

 

注意:下面兩句不能換行,且網站本地路徑中不能包含中文字元。

AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj licx rem resources resx soap vb vbproj vsdisco webinfo

AliasMatch /aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*) \"C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4"

然後再 httpd.conf 檔案末尾添加

[plain] view plain copy 
  1. #mod_aspdotnet support  
  2. Include conf/mod_aspdotnet.conf  

最後重啟 Apache 即可。

3. 測試

編寫測試頁default.aspx,放在“f:/demo” 目錄下

輸入測試頁:http://localhost:8080/aspnet/default.aspx

用 Apache 發布 ASP.NET 網站

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.