本文将为大家介绍的是Mono 2.8上安装部署ASP.NET MVC 2框架的方法。基于的操作系统是Opensuse 11.3,希望对大家有所帮助。
AD: Xtreme Toolkit Pro - 界面套包 —正版、购买、下载、价格、销售、代理、授权、技术支持尽在控件中国网
Mono 2.8发布:C#4.0和更好的性能,们知道Mono 2.8对ASP.NET MVC 2的完全支持,下面们就来测试下在Mono 2.8上部署ASP.NET MVC 2应用程序。环境是Opensuse 11.3,通过以下命令部署好Mono 2.8的开发环境,之所以说是开发环境是同时会更新MonoDevelop,支持Mono2.8的程序开发:
zypper addrepo http://ftp.novell.com/pub/mono/download-stable/openSUSE_11.3 mono-stable zypper refresh --repo mono-stable zypper dist-upgrade --repo mono-stable
然后启动MonoDevelop生成一个ASP.NET MVC 2应用程序TestMvc2。
们使用Apache2 + mod_mono进行部署,设置一个虚拟主机:
VirtualHost *:80 ServerAdmin webmaster@dotnetting.com ServerName www.dotnetting.com # DocumentRoot: The directory out of which you will serve your # documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. DocumentRoot /srv/www/vhosts/dotnetting/public_html # if not specified, the global error log is used ErrorLog /srv/www/vhosts/dotnetting/logs/error.log CustomLog /srv/www/vhosts/dotnetting/logs/access_log combined # don't loose time with IP address lookups HostnameLookups Off # needed for named virtual hosts UseCanonicalName Off # configures the footer on server-generated documents ServerSignature On # Optionally, include *.conf files from /etc/apache2/conf.d/ # # For example, to allow execution of PHP scripts: # Include /etc/apache2/conf.d/mod_mono.conf MonoServerPath www.dotnetting.com /usr/bin/mod-mono-server4 MonoDebug www.dotnetting.com true MonoSetEnv www.dotnetting.com MONO_IOMAP=all MonoApplications www.dotnetting.com /:/srv/www/vhosts/dotnetting/public_html Location / Allow from all Order allow,deny MonoSetServerAlias www.dotnetting.com SetHandler mono SetOutputFilter DEFLATE SetEnvIfNoCase Request_URI \.(?:gif|jpg?g|png)$ no-gzip dont-vary /Location IfModule mod_deflate.c AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript /IfModule /VirtualHost
这是一个通用的ASP.NET虚拟主机配置,唯一的一行不同就是MonoServerPath上设置的Mvc1还是mvc2,们这里设置为mod-mono-server4,如果你没有修改这个地方,会收到一个错误是web.config 的 targetFramework不对。然后把们生成测试程序拷贝到/srv/www/vhosts/dotnetting/public_html 。
注:Mono2.8已经移除了对.NET 1.1的支持,因此也就不能设置为mod-mono-server1
重启Apache2
service apache2 restart
通过浏览器访问www.dotnetting.com ,记得在访问之前在host文件中配置域名的解析。可以看到下面的页面:
附:个人常用的VIM命令列表
http://dev.csdn.net/htmls/76/76253.html
原文标题:在Mono 2.8上部署ASP.NET MVC 2
链接:http://www.cnblogs.com/shanyou/archive/2015/10/08/1846171.html
Xtreme Toolkit Pro - 界面套包 —正版、购买、下载、价格、销售、代理、授权、技术支持尽在控件中国网