在CentOS6.5上使用Jexus安裝部署ASP.NET MVC4和WebApi_伺服器其它

來源:互聯網
上載者:User

Jexus 即 Jexus Web Server,簡稱JWS,是Linux平台上的一款ASP.NET WEB伺服器,是 Linux、Unix、FreeBSD 等非Windows系統架設 ASP.NET WEB 伺服器的核心程式,是企業級ASP.NET跨平台部署的一種可選方案。與其它WEB伺服器相比,Jexus不但具有跨平台ASP.NET伺服器這樣的標誌性特徵,同時還擁有核心級的安全監控、入侵檢測、URL重寫、無檔案路由等一系列重要功能和專有特性。

一、使用Jexus5.8.1獨立版

網址http://www.linuxdot.net/ ps:該“獨立版”支援64位的CentOS 6.5、Ubuntu 12.04以上版本的作業系統,能運行WebForm、Mvc3-5、WebService 以及WebApi,支援PHP,支援OWIN,支援反向 Proxy,也就是說,無需安裝mono的“獨立版”與需要安裝mono的“通用版”在功能上是完全相同的。

下載 cd /tmp wget http://www.linuxdot.net/down/jexus-5.8.1-x64.tar.gz

解壓 tar -zxvf jexus-5.8.1-x64.tar.gz

移動 mv jexus /usr/local

測試 在/var/www/default/ 用vim建立一個簡單index.apsx<%@Page Language="c#" %><%=DateTime.Now.ToString()%>

二、Jexsus常用命令

啟動 ./jws start

重啟 ./jws restart

停止`./jws stop`

啟動某個網站 start 網站名

重啟某個網站 restart 網站名

關閉某個網站 stop 網站名

三、使用vs2013建立一個基本mvc4項目

修改引用Microsoft.Web.Infrastructure 複製本地設為False

建立HomeController和View/Home/Index.chstml (重要,不建立是沒有預設頁面異常:System.Web.HttpException)

建立ApiTestController(可選)

修改設定檔(重要)

<?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>

聯繫我們

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