Apache中運行Asp.net

來源:互聯網
上載者:User
這幾天又玩了一下Apache HTTP Server
Apache有著強大的Web伺服器配置功能,不然也不會成為全球使用量最大的Web伺服器架設工具,不過預設安裝的Apache不能運行asp.net,太可惜了,因為最近玩Asp.net所以迫切要求在Apache上面能運行Asp.net,網上找了下,很快就有了答案:
http://weblogs.asp.net/israelio/archive/2005/09/11/424852.aspx

稍作解釋:
http://www.apache.org/dist/httpd/binaries/win32/
下載Apache HTTP Server最新的MSI Installer Package或Installer Package進行安裝
http://www.apache.org/dist/httpd/mod_aspdotnet/
下載mod_aspdotnet最新的MSI Installer Package進行安裝
然後編輯Apache的設定檔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> 
  # 載入 ASP.NET /asp 應用程式 
  AspNetMount /SampleASP "c:/SampleASP" 
  Alias /SampleASP "c:/SampleASP" 
  #/SampleASP 相當於IIS中的虛擬目錄,指向"c:/SampleASP",可自訂修改
  # 運行http://localhost/SampleASP 查看

  # 設定目錄許可權
  <Directory "c:/SampleASP">
    Options FollowSymlinks ExecCGI
    Order allow,deny
    Allow from all
    DirectoryIndex index.htm index.aspx
   #這句相當於IIS中設定預設文件
  </Directory>

  # 指定aspnet_client目錄路徑
  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">
    Options FollowSymlinks
    Order allow,deny
    Allow from all
  </Directory>
</IfModule>
#asp.net


C:/SampleASP及其別名——虛擬目錄名可自訂修改,儲存,Restart Apache.

在SampleASP中添加index.aspx檔案,在http://localhost/SampleASP/index.aspx進行測試.

完畢!

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.