Ubuntu Server 10.0.4+Apache 下配置 mono 下運行 asp.net
來源:互聯網
上載者:User
修改網路設定檔sudo vi /etc/network/interfaces增加或修改auto eth0部分內容:auto eth0iface eth0 inet staticaddress 192.168.3.90 #固定ipgateway 192.168.3.1 #預設閘道netmask 255.255.255.0 #子網路遮罩將上面內容替換成你自已的修改dnssudo vi /etc/resolv.conf修改其中 nameserver 的值網路設定修改完成後,請使用sudo /etc/init.d/networking restart來使網路設定立即生效好了,這些部分我們不多說了,不明白的大家可以去google.下面我們來安裝open ssh,它非常重要,能夠讓我們遠端管理我們伺服器,安裝非常簡單:sudo apt-get install openssh-server說到這裡我給大家提供兩個工具,後面有下載,一個就是上面說的到PuTTy,用來管理linux和執行shell一個就是winscp,它可以管理linux上的檔案.使用winscp可以管理伺服器檔案我們接著安裝apachesudo apt-get install apache2安裝完成後,我們立即就可以在瀏覽器中測試,輸入伺服器ip:安裝monosudo apt-get install mono-gmcs mono-xsp2 libapache2-mod-mono mono-apache-server2sudo a2enmod mod_mono這裡遇到一個問題,在安裝libapache2-mod-mono後會出現很久無法返回狀況,每次都是重啟來解決,重啟後執行下一個命令時系統會提示E:dpkg was interrupted ,you must manually run 'sudo dpkg --configure -a' to correct the problem造成這種提示原因就是剛才的安裝被中斷了,但是執行libapache2-mod-mono等好久都無法返回,所以只有重啟.不過沒關係,按他說的執行sudo dpkg --configure -a上傳了一個help.aspx檔案到 /var/www/下面.運行時發現.net代碼根本沒執行,服務端控制項基本無效最後找到原因,mono沒有正確配置.net引擎目錄,當然不會執行.於是找到 /etc/apache2/mods-available/mod_mono.conf 檔案.使用命令編輯 sudo vim /etc/apache2/mods-available/mod_mono.conf修改為: AddType application/x-asp-net .aspx .ashx .asmx .ascx .asax .confi .ascx .axdDirectoryIndex index.aspxMonoAutoApplication enabledMonoServerPath "/usr/bin/mod-mono-server2"Include /etc/mono-server2/mono-server2-hosts.conf 編輯完成後,重啟apachesudo /etc/init.d/apache2 restart 我們再重新整理剛才頁面,正常了,簡單服務端控制項,事件回傳都沒有問題.