ASP. NET mvc3 on Mono (2): deployment in Linux (opensuse)

Source: Internet
Author: User

The previous article introduced the deployment of Mono in windows. For me, the deployment of Mono in Linux is more challenging than that in windows. I have never had any Linux experience. To deploy mono in Linux, I have encountered not only mono deployment problems, but also various Linux operations. I am using a security-configured Virtual Machine downloaded from mono. The installation problems can be skipped for the moment. However, we should summarize the problems here, first, familiarize yourself with several common opensuse operations.

1) to configure the NIC and perform file management, the superuser (SU) password is required. The official download Vm and the su password is mono. I didn't know at the beginning, but I had to wait for a while. In fact, the default homepage for accessing http: // localhost shows the user password.

2) The configuration path of Apache is:/etc/apache2 /. The default site directory is/srv/www/htdocs/. You will switch between the two directories frequently.

3) to modify the configuration, you need to open the file manager with the permissions of the Super User, which also takes me some time to search. The solution is to create a command line shortcut. Read this post.

4) restart the Apache command line:/etc/init. d/apache2 restart

5) If necessary, it is best to read out what is YaST and what is the installation source. In Linux, You have to compile and install the source code, which is scary. The used VPC was downloaded before and installed with mono 2.8. Yesterday, we used YaST to automatically upgrade to mono 2.10.

In conclusion, the deployment of Mono ASP. NET in Linux is mostly not as visualized as in IIS, but it is a command line. It seems to be horrible, but it is not as complicated as imagined. First, we need to familiarize ourselves with several official documents (mod_mono, autohosting, and Apache mod_mono Configuration tool), learn about the working principles, and then implement them without detours. Another lesson is to first deploy the earlier version, which is simple, and then try the features supported by the new version, for example, deploy simple ASP. net webform page (a simple page), and then deploy the MVC site; deploy mvc1.0 first, and then deploy the latest mvc3.0, so that even if an error occurs, it is more conducive to troubleshooting. At the beginning, I directly tossed mvc3, that cup.

According to the official documentation, there are two deployment methods in opensuse + Apache: Automatic hosting and manual configuration file deployment:

1. Automatic hosting: you only need to configure Apache once. to deploy a mono site in the future, you only need to copy the xcopy file to the site directory. No additional deployment is required. Refer to autohosting for the following steps:

1) Add the following in/etc/apache2/httpd. conf:Include/etc/apache2/mod_mono.conf(The actual path of this file in opensuse 11.3 isInclude/etc/apache2/CONF. d/mod_mono.conf) To introduce the configuration of mod_mono.

2) add this line to the mod_mono.conf file:Monoautoapplication Enabled. In the official documentation, you also need to add: monoserverpath "/usr/bin/mod-mono-server2", but in fact it does not seem necessary. And I changed to: monoserverpath "/usr/bin/mod-mono-server4", it also does not work, don't know what the problem is.

3) to deploy the MVC site, you also need to add this line to the mod_mono.conf file:Forcetype application/X-Asp-net.However, automatic hosting is not recommended for MVC sites.

After the above configuration, when we deploy the ASP. NET site, we only need to copy the directory to/srv/www/htdocs/to complete the deployment. The file directory corresponds to the virtual directory of the site.

2. Create a deployment file manually.ArticleDeploying ASP. net mvc 2 on Mono 2.8 is a bit dizzy. That configuration file is enough to give me a headache. Previously, I ignored Apache mod_mono Configuration tool. After reading a few official documents, I realized the importance of this tool. This tool will provide several input Boxes Based on the site we want to deploy. Then we can download the generated configuration files and directly download these configuration files:/Etc/apache2/CONF. d/You can work normally without configuring other sites.

3. The most common deployment method is to check how the built-in sites are deployed and directly copy several of their configuration files. The same is true for repair, modification, and modification. At the beginning, I was confused when I didn't follow the normal process. I used this method to successfully deploy the site. In addition, the mvc3 site is directly deployed.

To sum up, I found that deploying mono ASP. NET in Linux is not very difficult. It was just a bit of a detour at the beginning, and the mood was a little impatient. However, the mvc3 problems mentioned in the previous article also exist in Linux. We should be able to judge the bug of mono2.10, but this bug is too low-level, are they not submitting tests? In this case, we hope to solve these bugs as soon as possible.

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.