整合现有的ASP.NET MVC应用程序果园CMS [英] Integrate existing ASP.NET MVC application with Orchard CMS
问题描述
我有果园CMS和我想用它整合我的MVC的网站。谁能告诉我该怎么做呢?
I have Orchard CMS and I want to integrate my MVC site with it. Can anybody tell me how to do this?
推荐答案
这取决于复杂的MVC应用程序是,但在大多数情况下,它是straighforward。最简单的方法是将包装你现有的网站到果园模块。写模块这里描述。这些都是必要的步骤:
It depends on how complex your MVC app is, but in most cases it is straighforward. The easiest way is to wrap your existing site into Orchard module. Writing a module is described here. These are the necessary steps:
- 您的网站复制到在〜/ Orchard.Web /模块随着.csproj的文件,这样的.csproj文件应该在你的应用程序根目录(例如:〜/ Orchard.Web一个子目录/Modules/MyApplication/MyApplication.csproj)
- 在您的应用程序的根目录下的创建Module.txt清单文件。这个小文件描述您的应用程序 - 它的语法描述这里
- 设置相应的路由,这样当前的控制器的行动可以被击中。它在上面的文章还描述。默认情况下,你的应用程序的URL看起来像/所有MyApplication /控制器/动作 - 你是自由的,你想改变它。不过要小心不干扰现有航线,如。 /管理员,/用户等。您指定的路径具有更高的优先级,将覆盖每一个已有的那些。顺便说一句 - 区域的名字,在必要时将您的应用程序的名称(如:所有MyApplication)的。
- 润园,使您的应用程序模块/功能管理菜单。
- 添加必要的更改web.config文件。
- Copy your site to a subdirectory under ~/Orchard.Web/Modules along with the .csproj file so that the .csproj file should be in your application root (eg. ~/Orchard.Web/Modules/MyApplication/MyApplication.csproj)
- In the root of your app create a Module.txt manifest file. This small file describes your application - its syntax is described here
- Set appropriate routes so that existing controllers' actions can be hit. It's also described in the article above. By default, your application URLs will look like /MyApplication/Controller/Action - you're free to change it as you wish. Be careful though not to interfere with existing routes, eg. /Admin, /Users and so on. The routes you specify have higher priority and will override every exisiting ones. Btw - Area name, where necessary, would be the name of your application (eg. MyApplication).
- Run Orchard and enable your application in Modules/Features admin menu.
- Add necessary changes to web.config file.
但请记住这果园是基于ASP.NET MVC 4,使用剃刀视图引擎。如果你使用的是其他的视图引擎,你必须在web.config文件中适当地指定它。
Remember though that Orchard is based on ASP.NET MVC 4 and uses Razor view engine. If you use some other view engine, you have to specify it appropriately in the web.config file.
这篇关于整合现有的ASP.NET MVC应用程序果园CMS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!