Deploy ASP.NET MVC 4 application + WCF service to the free AppHarbor cloud

By | October 9, 2013

Advertisement from Google

This article is a step by step instruction to deploy your ASP.NET MVC 4 application that hosts WCF service to the free AppHarbor cloud hosting with MS SQL server and NewRelic monitoring functionality.

Configure AppHarbor

appharborYou need to register an account on, then go to “Your Applications” and create the new one. For example we will create application with name “testForBlock”.

Then you should add SQL server add-on to your site. Go to “add-on catalog”, select “SQL Server” and install free “Yocto” edition. Then go back to “add-on catalog” and install free New Relic add-on.

Create MVC 4 application with WCF service

Create empty MVC 4 web application project “testForBlock”, add WCF service library in to created solution with name “testForBlockService”.

Go to AppHarbor application and switch to “Configuration varialbes” section. Copy SQLSERVER_CONNECTION_STRING and use it with your data provider in web.config.

Install and configure Git

Go to and install github client for windows, which contains git powershell cmdlet. Run Git Shell from desktop.

Perform first-time git setup by running:

git config --global "John Doe"
git config --global

then go to AppHarbor and copy your application repository url. Initiate new local git repository:

cd C:\path\to\my\application\solution
git init 
git remote add appharbor MY_REPOSITORY_URL

Advertisement from Google

Create following .gitignore file:


And commit your solution to appharbor:

git add .
git commit -m "Initial commit"
git push appharbor master

You will see that appharbor cannot build the application with WCF service, the following error will be in log:

"Microsoft.VisualStudio.ServiceModel.targets" was not found

To fix this error you should add Microsoft.VisualStudio.ServiceModel.targets (this file located in C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\WCF folder) to your “testForBlockService” service project. Then open testForBlockService.csproj for edit and replace

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\WCF\Microsoft.VisualStudio.ServiceModel.targets" />


<Import Project="Microsoft.VisualStudio.ServiceModel.targets" />

Commit changes to appharbor.

Now you can use your application.

Leave a Reply

Your email address will not be published. Required fields are marked *