Ubuntu installs mono2.10 and uses Apache to host ASP. NET mvc3 applications

Source: Internet
Author: User
Tags classic asp ssh server

ASP. net has long criticized large-scale deployment for its high cost. The emergence of Mono is.. NET application opens the door to Linux.. NET applications can be deployed at a low cost. Recently, in order to try ASP. net mvc3 is deployed in Linux. I have read a lot of materials, but I found that most of them are in opensuse. There are few articles about how to use apache2 In ubuntu, however, I finally found some valuable and finally successfully installed and deployed, and summarized the installation process for the majority of users. neter reference.

0. Before installation

Ubuntu10.04 is a new installation, and three roles, SSH server, lamp server, and samba, are selected during installation.

1. Install the dependency program

apt-get install build-essential bison gettext pkg-config autoconf libtool automake

2. Install mono2.10

wget http://ftp.novell.com/pub/mono/sources/mono/mono-2.10.tar.bz2tar -xjvf mono-2.10.tar.bz2cd mono-2.10./autogen.shmakesudo make installcd ..

Remember that make install requires sudo. Otherwise, a message indicating no permission is displayed.

In reference [1. /autogen. sh has a path parameter in one line, but it is found that the actual input path parameter will prompt that this parameter cannot be found, so it is canceled. After installation, the path is under/usr/local/bin.

3. Install the xsp Server

wget http://ftp.novell.com/pub/mono/sources/xsp/xsp-2.10.tar.bz2tar -xjvf xsp-2.10.tar.bz2cd xsp-2.10./configuremakesudo make installcd ..

For more information, see./configure in [1 ].

4. install Apache-Dev

apt-get install apache2-dev

5. Trim Related Files

sudo mv /etc/apache2/mod_mono.conf /etc/apache2/mods-available/sudo a2enmod mod_monosudo service apache2 restart

After mod_mono is installed by default, mod_mono.conf will appear directly in/etc/apache2. apache2 in Ubuntu adopts the policy of separating the contained configuration file. You need to copy mod_mono.conf to mod-available and enable mod_mono.

6. Modify the site configuration file

<VirtualHost *:80>ServerAdmin webmaster@localhostServerName mono.me.comDocumentRoot /var/www/monoMonoServerPath mono.me.com "/usr/local/bin/mod-mono-server4"MonoDebug mono.me.com trueMonoSetEnv mono.me.com MONO_IOMAP=allMonoApplications mono.me.com "/:/var/www/mono"<Location "/">Allow from allOrder allow,denyMonoSetServerAlias mono.me.comSetHandler monoSetOutputFilter DEFLATESetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-zip dontvary</Location><IfModule mod_deflate.c>AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript</IfModule>ErrorLog /var/log/apache2/error-mono.log# Possible values include: debug, info, notice, warn, error, crit,# alert, emerg.LogLevel debugCustomLog /var/log/apache2/access-mono.log combined</VirtualHost>

In addition to manual changes, this configuration file can also be automatically generated using mono config tool.

Pay attention to the "monoserverpath mono.me.com"/usr/local/bin/mod-mono-server4 "line, mono2.10 take the above default process after installation is completed and not mentioned in many articles/usr/bin, in/usr/local/bin

The DocumentRoot/var/www/MONO directory must have the execution permission. Otherwise, Apache reports the error 403.

7. Deploy the site

Create an ASP. the. NET mvc3 application generates a deployment package for the MVC project, copies the package to the site root directory set in step 1 through samba, and restarts the apache2 service, set the host on the client and enter the domain name in the browser. If everything works, congratulations! You can see a classic ASP. net error page, set customererror to off, you will see, because a system is missing. web. helpers DLL. Return to the MVC project.

(1) Add the following reference

System. Web. Razor. dll
System. Web. webpages. Razor. dll
System. Web. webpages. Deployment. dll

(2) set the DLL referenced below to be copied to the local device.

System. Web. helpers. dll
System. Web. MVC. dll
System. Web. webpages. dll
System. Web. Razor. dll
System. Web. webpages. Razor. dll
System. Web. webpages. Deployment. dll

(3) re-generate the deployment package and overwrite the bin directory on the server.

OK, now you have got rid of the expensive window server. Of course, pirated users can secretly walk away. If you want to get rid of the expensive SQL Server, you can use MySQL, PostgreSQL, and MongoDB. If you don't need any powerful performance, SQLite is also a good choice.
 

References:

[1] How To Get ASP. net mvc 2 working with mono in 10 steps-buddylindsey

[2] ASP. net mvc 3 with razor on Mono 2.10.1-Robert Jordan

[3] configure Apache mod_mono

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.