Mono+Jexus讓C#運行在Linux(centos7_x64),學習筆記

來源:互聯網
上載者:User

標籤:top   put   系統   schema   elf   比較   bison   erb   settings   

本篇目錄
  • 前言

  • 環境準備

  • Linux下環境準備

    • 系統更新

    • 安裝Mono源碼安裝需要的庫

    • 安裝Mono需要的GDI+相容API的庫Libgdiplus

    • 安裝 mono

    • Jexus安裝

  • 部署ASP.NET MVC項目

    • Jexus配置

    • VS2013建立MVC項目打包發布

  • 總結

前言

感謝:

http://www.jexus.org/

http://www.cnblogs.com/shanyou/archive/2012/01/07/2315982.html

http://www.cnblogs.com/hanyinglong/p/5456757.html

http://www.jb51.net/article/83550.htm

http://www.cnblogs.com/hanyinglong/p/5456757.html

http://bbs.csdn.net/topics/390944302

 

環境準備

虛擬機器:VMware-workstation-full-11.0.0-2305329_0;

Linux系統:CentOS-7-x86_64-DVD-1511.iso;

Visual Studio 2013:建立預設ASP.NET MVC 4 Web 應用程式;

Linux串連工具:SecureCRT;

Linux下環境準備 更新系統

可以跳過,有四百多條更新。

yum –y update

安裝Mono源碼安裝需要的庫

yum -y install gcc gcc-c++ bison pkgconfig glib2-devel gettext make libpng-devel libjpeg-devel libtiff-devel libexif-devel giflib-devel libX11-devel freetype-devel fontconfig-devel  cairo-devel

 安裝Mono需要的GDI+相容API的庫Libgdiplus

cd /usr/local/src/

libgdiplus,當前最新版本libgdiplus-4.2.tar.gz | 2015-12-20 17:33 | 671K

wget http://download.mono-project.com/sources/libgdiplus/libgdiplus-4.2.tar.gz

tar -zxvf libgdiplus-4.2.tar.gz

cd libgdiplus-4.2

./configure --prefix=/usr

make && make install

 安裝 mono

cd /usr/local/src/

mono,當前最新版本mono-4.6.2.6.tar.bz2 | 2016-11-02 14:22 | 79M

wget http://download.mono-project.com/sources/mono/mono-4.6.2.6.tar.bz2

tar -jxvf mono-4.6.2.6.tar.bz2

cd mono-4.6.2

./configure --prefix=/usr

make這步的時間稍微比較久點。

make && make install

安裝完後使用mono -V查看版本資訊。

 Jexus安裝

cd /usr/local/src/

Jexus,當前最新版本jexus-5.8.1.tar.gz

wget http://www.linuxdot.net/down/jexus-5.8.1.tar.gz

tar -zxvf jexus-5.8.1.tar.gz

cd jexus-5.8.1

./install

啟動命令。

/usr/jexus/jws start


啟動成功後通過http://localhost/info訪問到如下頁面。

至此環境準備工作完成。

部署ASP.NET MVC項目  Jexus配置

cd /usr/jexus/siteconf/

cp default simple

賦值預設配置修改port、root。

配置修改完成後到/var目錄下建立www檔案夾。

cd /var

mkdir www

 

 VS2013建立MVC項目打包發布

使用SecureFX將打包檔案夾simple上傳至/var/www/simple目錄。

將jexus停止後重新啟動

/usr/jexus/jws stop

/usr/jexus/jws start

啟動成功後通過http://localhost/info訪問出現如下錯誤資訊。

將Web.config檔案內容替換成如下資訊重新上傳。

<?xml version="1.0" encoding="utf-8"?><!-- 有關如何配置 ASP.NET 應用程式的詳細資料,請訪問 http://go.microsoft.com/fwlink/?LinkId=169433 -->  <configuration> <appSettings>  <add key="webpages:Version" value="2.0.0.0" />  <add key="webpages:Enabled" value="false" />  <add key="PreserveLoginUrl" value="true" />  <add key="ClientValidationEnabled" value="true" />  <add key="UnobtrusiveJavaScriptEnabled" value="true" /> </appSettings>   <runtime>    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">     <dependentAssembly>      <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>      <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />     </dependentAssembly>     <dependentAssembly>      <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />      <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />     </dependentAssembly>     <dependentAssembly>      <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />      <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />     </dependentAssembly>       <dependentAssembly>      <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />      <bindingRedirect oldVersion="1.0.0.0-1.3.0.0" newVersion="1.3.0.0" />     </dependentAssembly>       <dependentAssembly>      <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" />      <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />     </dependentAssembly>      </assemblyBinding>   </runtime>    <system.web>       <customErrors mode="Off"/>  <pages>   <namespaces>    <add namespace="System.Web.Helpers" />    <add namespace="System.Web.Mvc" />    <add namespace="System.Web.Mvc.Ajax" />    <add namespace="System.Web.Mvc.Html" />    <add namespace="System.Web.Routing" />    <add namespace="System.Web.WebPages" />   </namespaces>  </pages> </system.web>   <system.webServer>  <validation validateIntegratedModeConfiguration="false" />     <handlers>   <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />   <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />   <remove name="ExtensionlessUrlHandler-Integrated-4.0" />   <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />   <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />   <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />  </handlers></system.webServer></configuration>

/usr/jexus/jws restart

log4net引用到項目中。

重新啟動後重新整理能訪問顯示如下,但是樣式資訊未應用。這是因為Linux下是區分大小寫,需要配置jexus。

cd /usr/jexus/

vi jws

取消# export MONO_IOMAP="all"這段內容的前面的#,儲存,然後重新啟動jexus。

重啟jws後,重新訪問結果。

 

總結

沒寫完。

Mono+Jexus讓C#運行在Linux(centos7_x64),學習筆記

聯繫我們

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