在Linux上部署ASP.NET MVC:最佳做法,工具和工具;惊喜 [英] Deploy ASP.NET MVC on Linux: Best Practices, Tools & Surprises

查看:584
本文介绍了在Linux上部署ASP.NET MVC:最佳做法,工具和工具;惊喜的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道开发ASP.NET MVC应用程序以及可以在Linux上部署的选项的最佳实践.如果您要创建这类MVC应用,

I'm wondering about best practices to develop ASP.NET MVC apps with an option to deploy on Linux. If you are creating these kinds of MVC apps,

  • 您要定位的Linux/Mono平台是什么?
  • 您在Windows上进行了多少开发,在Linux上进行了多少开发?
  • 您是否正在使用ORM来抽象数据库?哪一个?
  • 您是否正在Linux上运行构建引擎?那测试呢?
  • 您还使用其他哪些工具?
  • 除了Windows之外,针对Linux还做了多少其他工作?
  • 您遇到了哪些丑陋或令人惊喜的惊喜?

推荐答案

我为之工作的公司将Linux上的Mono作为我们的主要部署环境.因此,没有额外的"工作-我们提供从硬件到操作系统(自定义和修剪)到应用程序的整个堆栈.使用开源可以为我们和我们的客户节省大量资金(是的,我们确实为我们所依赖的OS项目做出了贡献.)

The company I work for targets Mono on Linux as our main deployment environment. Thus there is no "additional" work - we provide the whole stack, from hardware, through operating system (customized and trimmed) to applications. Using Open Source gives huge savings for us and our clients (and yes, we do contribute back to the OS Projects we rely on).

重要的是要不断使用实际目标进行测试(对不起,Windows上的Mono不算在内).当然,开发人员使用Visual Studio,但仍在进行持续集成(使用 CruiseControl. Net ,您需要在Windows和Linux上完成Mono 2.4.2才能在Windows和Linux上运行,测试我们希望使用的所有Mono版本(最近它变得更加稳定,但是回归确实可以发生在两次发布之间).在一个* nix系统上运行并行Mono版本相当容易,您甚至可以包括svn快照版本您更喜欢尽早捕获上游回归.如果您不发布自己的发行版,请记住大多数Linux供应商都在Mono发行时附带了自定义补丁-这以前给我们造成了麻烦.另外,许多发行版在更新Mono方面存在很多滞后,这是一个快速发展的项目.

The important thing is to constantly test using your actual target (sorry, Mono on Windows doesn't count). Sure, developers use Visual Studio, but the continous integration (using CruiseControl.Net, you'll need Mono 2.4.2 to run it on Linux) is done both on Windows and Linux, testing all Mono versions we expect to work on (it got much more stable recently, but still, regressions do happen between releases). It's quite easy to run parallel Mono versions on one *nix system, you can even include an svn snapshot build if you prefer to catch upstream regressions early. If you don't roll out your own distribution, then remember that most Linux vendors ship Mono with custom patches - this has caused problems for us before. Also, many distributions have a lot of lag updating Mono, and this is a rapidly advancing project.

对于数据库层,我们主要使用普通"的ADO.NET-Oracle(带有 dotConnect for Oracle dotConnect ,它们支持Mono)和SQLite(Mono附带有效的连接器).我还使用了官方的用于MySQL的ADO.NET驱动程序(Connector/NET),同样,效果很好. ORM映射比较棘手,但是NHibernate可用(请记住,它们正式支持Mono).

For database layer we use mostly "plain" ADO.NET - Oracle (with dotConnect for Oracle, they support Mono) and SQLite (Mono ships with a working connector). I have also used the official ADO.NET Driver for MySQL (Connector/NET) and it, too, works well. ORM mappings are more tricky, but NHibernate is usable (keep in mind that they do not support Mono officially).

关于构建引擎和测试- NAnt

As for the build engine and tests - NAnt and NUnit are well known and well tested. With most recent versions of Mono xbuild (clone of MSBuild) actually got usable, but prepare yourself for contributing quite a lot patches if you decide to use it for more complex scenarios.

编写测试.其中很多.准备贡献补丁和错误报告,如果您使用商业组件,请确保供应商正式支持Mono.

Write tests. Lots of them. Be prepared to contribute patches and bugreports, and if you use commercial components - make sure the supplier officially supports Mono.

这篇关于在Linux上部署ASP.NET MVC:最佳做法,工具和工具;惊喜的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆