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,支持反向代理,也就是說,無需安裝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(可選)
修改配置文件(重要)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
<? 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 > |