在Ubuntu中搭建.NET開發環境

來源:互聯網
上載者:User

標籤:style   blog   http   color   使用   strong   

Mono簡介
Mono是Xamarin公司C#和CLR的ECMA標準基於開發的一個開源的.NET實現版本,它是Linux平台上開發.NET應用程式首選。同時其也提供了Xamarin.IOS和Xamarin.Andriod,是我們可以直接使用C#開發IOS和Andriod手機開發。
安裝Mono
Mono的烏班圖版本是由社區提供維護的。以下的版本在標準的Ubuntu庫中是可用的:
Ubuntu Hardy (8.04 LTS):     1.2.6
Ubuntu Lucid (10.04 LTS):     2.4 branch snapshot
Ubuntu Natty (11.04):     2.6.7
Ubuntu Oneiric (11.10):     2.10.5
Ubuntu Precise (12.04 LTS):     2.10.8.1
Ubuntu Quantal (12.10):     2.10.8.1
Ubuntu預設安裝的應用程式例如Tomboy、F-Spot等是需要使用Mono的,所以在12.04以前的發布版本中就已經預設安裝了Mono。在12.04和以後的版本,我們可以使用mono-complete來安裝Mono的全部組件。安裝完成使用mono --version查看Mono相關資訊。

驗證Mono是否安裝成功
1. 開啟gedit並將如下代碼儲存為helloworld.cs檔案

using System; public class HelloWorld{    static public void Main ()    {        Console.WriteLine ("Hello Mono World");    } }

 


2. 使用mcs helloworld.cs編譯,完成後使用mono helloworld.exe執行產生的可執行檔。

安裝mono-fastcgi-server2
sudo apt-get install mono-fastcgi-server2

安裝Nginx
1.輸入以下命令安裝Nginx,sudo apt-get install nginx

2. 開啟以下設定檔 /etc/nginx/sites-available/default,並添加如下內容

server {         listen   30000;         server_name  localhost;         access_log   /var/log/nginx/mono.log;          location / {                 #root /usr/share/nginx/www;         root /home/hys/Mono/sites/mysite;                 index index.html index.htm default.aspx Default.aspx;                 fastcgi_index Default.aspx;                 fastcgi_pass 127.0.0.1:9000;                 include /etc/nginx/fastcgi_params;         } }

 


3. 開啟設定檔/etc/nginx/fastcgi_params,並添加如下內容

 fastcgi_param  PATH_INFO          ""; fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;

 


4. 在終端中執行如下命令啟動FastCgi伺服器
fastcgi-mono-server2 /applications=*:30000:/:/home/hys/Mono/sites/mysite /socket=tcp:127.0.0.1:9000
5. 啟動Nignx伺服器
 /etc/init.d/nginx start

安裝monoDevelop整合開發工具
sudo apt-get install monodevelop

聯繫我們

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