zoukankan      html  css  js  c++  java
  • 一起谈.NET技术,在Mono 2.8上部署ASP.NET MVC 2 狼人:

      我们知道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。

    image

      我们使用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文件中配置域名的解析。可以看到下面的页面:

    image

      附:个人常用的VIM命令列表

  • 相关阅读:
    WHERE col1=val1 AND col2=val2;index exists on col1 and col2, the appropriate rows can be fetched directly
    MySQL 交集 实现方法
    MBProgressHUD的使用
    Xcode4 使用 Organizer 分析 Crash logs(转)
    SimpleXML 使用详细例子
    PHP的XML Parser(转)
    iPhone,iPhone4,iPad程序启动画面的总结 (转)
    Pop3得到的Email 信件格式介绍
    yii总结
    隐藏Tabbar的一些方法
  • 原文地址:https://www.cnblogs.com/waw/p/2162799.html
Copyright © 2011-2022 走看看