Base solution for your next web application
Open Closed

Distributed WebAPI and MVC Site #739

roy created


With ABP, if I want to publish my Web API on one server and MVC Site on another server, how should I organize the assembly and dependency. (when the mvc site get an ajax call , it just simply dispatch the request to the Web API Server with HttpClient )

PS. the requirement is coming from : the Web API not just supply service to MVC Site , but also other app in different platform(like mobile app, desktop app, etc.)

3 Answer(s)
  • 0
    hikalkan created
    Support Team

    You can host web api in a seperated empty web application (like this project: <a class="postlink" href=""> ... mo.WebHost</a>). Then you can call WebAPI from your MVC application as you normally do. For example: <a class="postlink" href=""> ... Program.cs</a>

    So, you will have two application actually (one consists of core, application and web api layers and a web host project. Other one includes just an MVC project.)

  • 0
    roy created

    Yes, this solution work fine , but some great features of ABP ( like dynamic Web API , dynamic service proxy script according to IXxxAppService ) seems unavailable, right?

  • 0
    paddyfink created


    Like you I created also a separate web api project to host it on its own server. You can still have all the features abp.

    for the Dynamic web api, you just have to add this code on your module class ( you have to create manually one and inherited from abpmodule) :

                   .ForAll<IApplicationService>(typeof(MyAppApplicationModule).Assembly, "app")