Mono and Jexus and deploy ASP. MVC3, 4, 5, and Webapi

Source: Internet
Author: User
Tags domain name definition

Configure mono and Jexus under Linux (CentOS 6.7) and deploy ASP. MVC3, 4, 5, and Webapi (cross-platform) 1. First of all, before I write this blog, Having configured mono and Jexus locally and successfully deployed an ASP. NET MVC project, I also rely on the various data found on the Internet to configure the environment and deploy the project, and it has a lot of articles on the Internet, so I think I write or not write it, but want to go,   I would like to write about it, because the article is too cluttered, not the latest version, not very neat and may encounter a variety of problems, so I decided to write an article from the no-to-deploy project on-line and will be a lot of friendly tips and solutions, and hope to be able to integrate their own ideas. B. Because now cross-platform is a trend, online learning a lot of people, I may not write well, I hope you forgive me, the following start from scratch process it. 2.Mono and Jexus Simple description

A. Mono was initiated by Novell, a company that has been acquired by Microsoft and will be open-source, with a bright future. NET open source project used on Linux. It contains a compiler for the C # language, a CLR runtime and a set of class libraries, and implements both ADO and ASP, enabling developers to develop programs in C # under Linux. ), the project's goal is to create a series of. NET tools that conform to the standard ECMA (Ecma-334 and Ecma-335), including C #编译器和共同语言 (CL-Common Language) execution platform (Platform), with Microsoft. NET: The Mono project not only runs on Windows systems, but also runs on Linux, FreeBSD, Unix, Mac OS x, and Solaris, which can be said to be completely cross-platform.

B. Jexus, Jexus Web server, or JWS, is an ASP. NET Web server on the re-Linux platform, and Jexus for Linux has the following features:

B.1 supports multiple operating systems: Jexus's initial design goal is "cross-platform ASP." Because on the window system, IIS is already an excellent platform for ASP, so the current Jexus is designed to support non-Windows systems such as Linux and FreeBSD.

B.2 High Performance: "High performance" is an important design goal of Jexus, although Jexus is based on the mono environment, but Jexus is not entirely composed of Mono's. NET components, Jexus is a very clever introduction to the key code that involves performance linux/ The excellent features of UNIX itself guarantee the performance advantage of Jexus from the code level, while the Jexus framework features provide the basis for high performance. Jexus not like XSP, pure HTML also need to go through the ASP, not like Apache and Nginx servers, need to be indirectly through the form of plug-ins to support ASP, Jexus HMTL static file processing module, ASP. NET processing module, static file cache mechanism, EPOLL/POLL data transmission mechanism are highly integrated, starting from the architecture itself, to maximize the processing power and transmission speed of the Web server.

B.3 Security: Jexus kernel contains security monitoring mechanism, the vast majority of malicious access before entering the site will be Jexus directly pass off, this is Jexus different from other Web services a major feature.

B.4 Stability: From the operating mechanism, in the Jexus system, there is a management unit dedicated to monitoring the execution status of the work process, Any process exit or any one of the ASP. NET site application domain exits, will be found and restarted by the Management unit, thus ensuring that the jexus can always work uninterrupted, the old program itself, the code of the Jexus program to be concise, few bugs, at the same time, each version of Jexus before the official release, will go to Stringent stress tests, factors that affect stability, have been completely excluded before the official release.

B.5 powerful, jexus support URL rewrite, support multi-target server reverse proxy, support PHP, support gzip compression transmission and can use different ports, different virtual paths, different domain name set any number of sites.

B.6 installation, configuration, operation is simple, service community, all kinds of problems can be quickly processed, have good follow-up service support ability.

B.7 There are some benefits under the official website. See: http://www.linuxdot.net/bbsfile-3084

Note: Some of the content is from the network, thanks to Zhang Shanyu and other community activists.

C. Mono Official website: http://www.mono-project.com/

D. Jexus official website: http://www.jexus.org/

E. 工欲善其事 its prerequisite, then let's configure mono and Jexus and deploy the MVC website, the software that this operation needs and the system is as follows: Virtual machine (Vmware), CentOS system installed in virtual machine (64-bit) (IP : 192.168.37.138), Xshell, xftp as to how to use them we'll talk about it below.

3. Configure the Library Libgdiplus for the GDI + compliant API required by mono

A. After the simple introduction above, we begin to configure mono and Jexus, and first configure the libgdiplus before configuring mono.

B. Use Xshell to connect to CentOS, and then enter the update system command: YUM-Y update will upgrade the lower version of the system (my upgrade from centos6.4 to 6.7), and the 6.4 configuration is also possible.

C. After the completion of the implementation, in the installation of the necessary software, the command is as follows:

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

Note: It is possible that the computer has these files installed and can be viewed with the Rpm-qa libexif* command, but this is done directly in order to ensure foolproof.

D. After execution, jump to local to create your own folder Kencery, under this folder to create the Libgdiplus folder, the command is as follows:

D.1 (1): CD usr/local/(2): MkDir kencery (3): CD kencery/(4): MkDir Libgdiplus (5): CD libgdiplus/

E. Use the command wget to download the latest version of the Libgdiplus, the command is as follows, after the download is complete the package decompression (as to what is inside the installation package, please use the command ls-l view), as shown in:

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

E.2 TAR-ZXVF libgdiplus-4.2.tar.gz

      

Note: You can open http://download.mono-project.com/sources/libgdiplus/this site to view all the files, select the files you want to download, I download the latest libgdiplus.

F. Enter the libgdiplus-4.2 (CD libgdiplus-4.2) file and execute the following command to install

F.1./configure--prefix=/usr

F.2 Make

F.3 make Install

4. Configure Mono

A. The installation of Mono is a long time in the whole process, please be patient to install.

B. CD jump to Folder Kencery, create the Mono folder under this folder, the command is as follows:

B.1 (1): Cd/usr/local/kencery (2): MkDir Mono (3): CD mono/

C. Use the command wget to download the latest version of mono with the following command, unzip the package after the download is complete (as to what is inside the installation package, use the command ls-l to view it yourself) as shown in:

C.1 wget http://download.mono-project.com/sources/mono/mono-4.4.0.148.tar.bz2

C.2 TAR-JXVF mono-4.4.0.148.tar.bz2

      

Note: You can open http://download.mono-project.com/sources/mono/this site to view all the files, select the files you want to download, I download the latest mono.

D. Enter the mono-4.4.0 (CD mono-4.4.0) file and execute the following command to install

D.1./configure--prefix=/usr

D.2 make (see a lot of warnings, don't worry, no impact on project deployment)

D.3 make Install

E. After completion of the above command, enter MONO-V if it contains the version information of Mono, the installation is successful, the version information:

    

5. Configure Jexus

A. When the mono configuration is complete and the test is not a problem, then we can configure the Jexus.

B. CD jump to Folder Kencery, create Jexus folder under this folder, the command is as follows:

B.1 (1): Cd/usr/local/kencery (2): MkDir Jexus (3): CD jexus/

C. Use the command wget to download the latest version of the Jexus, the command is as follows, after the download is complete the package decompression (as to what is inside the installation package, please use the command ls-l view), as shown in:

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

C.2 TAR-ZXVF jexus-5.8.1.tar.gz

      

Note: Find the latest jexus download under the official website.

D. Enter the jexus-5.8.1 (CD jexus-5.8.1) file and execute the following command to install

D.1 sudo./install

Note: When executing the install script, Jexus is installed to/usr/jexus/by default, and if you want to install to a custom directory, you can add a directory parameter (sudo./install/usr/local/kencery/) When you execute the script. jexus/)

E. Because Jexus is a service, it can control the start, stop, restart of the whole service, the command is as follows, please test yourself

E.1 Starting Sudo/usr/jexus/jws Start

E.2 Stopping Sudo/usr/jexus/jws Stop

E.3 Restart Sudo/usr/jexus/jws Restart

F. Can also control the start, stop, restart of the specified website, the command is as follows: please Test yourself

F.1 Start Sudo/usr/jexus/jws start website (website name)

F.2 Stop Sudo/usr/jexus/jws Stop sizename (site name)

F.3 Restart Sudo/usr/jexus/jws Restart Sizename (site name)

G. Use command: Sudo/usr/jexus/jws start, if Jexus start OK, the installation is successful.

H. When the Jexus started successfully, we want to access the Jexus outside, but the browser access error, the use of ping domain name can be ping, but the browser access is a failure (hint: Unable to access this site, 192.168.37.138 response time too long), this is why? This is because the Jexus default is 80 port, and the system installation is completed after the 80 port is not allowed outside access, so access is not, set to open 80 ports to the outside world can access.

H.1 cd/etc/sysconfig/

H.2 Vim iptables Modify and save,:

      

H.3 Restart Service iptables restart

I. When h is complete, restart Jexus, enter the following URL to access, then the Jexus installation is completely successful, then we need to deploy the ASP. NET MVC project.

    

Note: The shortcut installation method (a pair of commands will be installed successfully jexus)

1. Installation: sudo curl Jexus.org/release/install | Sh

2. Update: sudo curl Jexus.org/release/upgrade | Sh

Description: The installation method using this command will be Jexus installed to the/usr/jexus location.

-------------------------------------gorgeous split line, below will be the ASP. The MVC project is deployed under Jexus-------------------------------------------------------

6. Deploying an ASP. NET MVC Project

A. When the mono configuration is complete and testing is not a problem, then we need to deploy the MVC project to it, so how do we deploy the project? This piece is important.

B. So how to deploy a new website program?

B.1 first need to establish a "website profile", Jexus installed under the path (I installed in/usr/jexus) under a siteconf folder, each of which is a Web site configuration file, each profile represents a site, in (/usr/ jexus/siteconf/), there is already a default Web site profile with the file name: "Default"; You can modify the configuration file, or you can assign the profile and modify it to a new site.

B.2 in the configuration file, the key three items are required:

Port: The port number is defined, and the port number is an integer, typically 80, or another integer below 65535, but this port number must not be used by other service programs.

Root: The definition of the virtual root path and the physical root path, the root path consists of two parts, the middle is separated by a space, the space before the Web site to indicate the virtual root path (usually "/", do not modify), the space is the contents of the folder to store the physical path (such as: "/var/www/ default/")

Hosts: Domain name definition, fill in the domain name to visit this site, if there are multiple domain names, the domain name separated by commas, but also can use "Pan domain name", such as: "*.mysite.com."

Site name: Jexus The name of the site configuration file as the site name.

B.3 first copy the default file, copy it to the siteconf under the Jexus installation path, and then modify the contents of the command as follows:

(1): cd/usr/jexus/siteconf/(2): CP default MMS (3): Vim MMS modified after saving:

B.3 this time in the Jexus we will be the site configuration file has been configured to complete, but has not uploaded the site, this time we need to upload the site, upload the path as shown in/var/www/mms, if there is no file, then create.

C. Visual Studio Deployment Web site

C.1 First we migrate the following project to Jexus, this project is not a demo, is a project used in the actual scene, so the structure is not, simply will be the main project, the project structure:

      

C.2 then use the release function of VS, will publish the project, and the general project publish exactly the same, here does not do the detailed explanation, please refer to: Http://blog.sina.com.cn/s/blog_ 8ce459cd0102v1kx.html, at the time of release, note the configuration under the Settings option: (I just started the configuration is always unsuccessful because of the reason for this configuration)

      

After the C.3 project is published, delete the useless file information:

D. Migrating a project to Jexus

D.1 first under Linux to jump to the directory where items need to be placed (CD/VAR/WWW/MMS), open xftp, upload the site files are in this directory,:

D.2 Second we need to open 8080 ports, in the article has said how to open port 80, reference to open, here is not a burden.

D.3 Restart the Jexus using the Jexus restart function or start the Web site (./jws start or./jws Start MMS (if this access is still a problem, start with the previous command))

E. Accessing projects after deployment is complete

E.1 deployment completed after the visit found the error as shown, there is a very messy content, because Linux is case-sensitive, so we need to configure Jexus, so that the case can be converted, then how will it be configured?

      

E.2 Open the Jexus configuration file (Vim JWs), cancel the # export mono_iomap= "All" in front of the #, save, and then restart Jexus (./jws restart) as shown in:

      

E.3 finally we visited in the browser (http://192.168.37.138:8080/): The project has been completely migrated to Jexus.

      

Note: I did a simple operation on the project without encountering any problems.

F. Note: This blog deployment project is the ASP. MVC5 project, can also deploy MVC3, 4 and Webapi, Welcome to try, if you encounter any problem can not solve, welcome to contact me to consult, we learn together.

The development of Jexus is very rapid, before the use of Jexus must be installed mono, now there is no need to install mono can be used in the Jexus version (of course, but also rely on mono, but the Jexus internal built-in a small mono environment), Study Address: http://www.cnblogs.com/yunei/p/5452120.html

Note: The Local has done the test, according to woo big Bro article to implement, no problem, please refer to the above blog for details.

Finally thanked Zhang Shanyu's article to give me the idea and the realization: http://www.cnblogs.com/shanyou/p/3218611.html

Mono and Jexus and deploy ASP. MVC3, 4, 5, and Webapi

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.