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.
You need to register an account on https://appharbor.com/, 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 http://windows.github.com 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 user.name "John Doe" git config --global user.email firstname.lastname@example.org
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
Create following .gitignore file:
[Bb]in [Oo]bj *.suo *.user
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.