Integrate existing ASP.NET MVC application with Orchard CMS

后端 未结 1 431
栀梦
栀梦 2020-11-30 20:01

I have Orchard CMS and I want to integrate my MVC site with it. Can anybody tell me how to do this?

相关标签:
1条回答
  • 2020-11-30 20:48

    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:

    1. 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)
    2. In the root of your app create a Module.txt manifest file. This small file describes your application - its syntax is described here
    3. 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).
    4. Run Orchard and enable your application in Modules/Features admin menu.
    5. Add necessary changes to web.config file.

    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.

    0 讨论(0)
提交回复
热议问题