Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I run an MVC app and WCF Web Api on the same AppHarbor site?

We have a solution with this structure.

  • OurApp.Web (mvc 3 project with controllers, views)
  • OurApp.Api (mvc 3 project with wcf web api service classes)
  • OurApp.Domain (entities, repositories, unit of work, etc)
  • OurApp.Tests (tests)

We want to use a dns structured like this:

http://www.ourapp.com points to OurApp.Web

http://api.ourapp.com points to OurApp.Api

We want to host on AppHarbor.

How can we do this?

like image 446
nacho10f Avatar asked Oct 24 '11 22:10

nacho10f


People also ask

What is the difference between WCF and web API?

WCF offers request-reply, one-way, or duplex while Web API is by default request-reply only. WCF is used for developing SOAP-based services whereas Web API is used for both SOAP-based and RESTful services. WCF does not offer any support for MVC features whereas Web API supports MVC features.

How to consume WCF service in MVC application?

Since WCF service application and MVC application both are in the same solution, we have to build the Service first and then the MVC application in order to consume the service in MVC application. Do the following for that, Right Click on the MvcWcfEF Solution in Solution Explorer and click on properties.

How do I run multiple MVC and WCF in one project?

Right Click on the MvcWcfEF Solution in Solution Explorer and click on properties. Check the "Multiple Startup Project " and set the application priority for WCF and MVC application (WCF service should be first and MVC afterwards), as in the following image.

How to create MVC application in Visual Studio 2017?

Step 1) Open Visual Studio and Create a web project. Step 2) Name your project and select MVC template. Step 3) A default Scaffold template generates for MVC having HomeController. Step 4) Same steps apply to Web API application as well, just select Empty project.


1 Answers

AppHarbor currently only supports deploying one application from any given repository. One option might be to fold the API into the web project. I did this for a non-web API WCF service here.

Another option is to maintain two AppHarbor applications, and use solution files named according to what application you want deployed for that application. That is, OurApp.Web.sln contains the Web project and any supporting projects and, OurApp.Api.sln references the API project and any supporting projects. Read more about AppHarbor solution file convention.

(disclaimer, I'm co-founder of AppHarbor)

like image 156
friism Avatar answered Nov 13 '22 05:11

friism