Deploying F# Web Job to Azure

Hi All,

This article is one of those that is going to help remind me how to do this deployment, as it can be a bit tricky.  If you are working with F# for web jobs, like I have started doing, there are a few steps.

  1. Create a new console application
  2. Add proper nuget packages
  3. Manually add a .dll reference and copy said .dll to output
  4. Zip up and deploy entire output folder.

Create new Console Application

This is easy.  See picture.

newConsoleApp

Add Proper Nuget Packages

  1. Microsoft.Azure.WebJobs.Core
  2. Microsoft.Azure.WebJobs

nugetpackages

These packages contain the framework for Azure Web Jobs.

Add Proper References

So I discovered that I needed FSharp.Core in my solution.  I got the craziest errors that seemed to have nothing to do with this, until I added a printf statement to see what my connection string was.  Anyways, you need to manually add a reference to FSharp.Core v4.3.1 .  You also need to copy this to the output directory of your solution, as setting the properties to copy currently does not actually copy this library as expected.

output

Zip Up Entire Folder and Deploy

This should be straight forward.  Using any other article out there in the world, you can deploy, but I will walk through here as well.

  1. Go to your Azure Portal http://azure.microsoft.com/en-us/
  2. Navigate to the website you wish to deploy this webjob with
  3. Click on the WebJobs section
  4. azurewebjobportal
  5. Click the Add button
  6. Name your web job
  7. Select your zipped up output folder
  8. Set your job per type you want (I use continuously as I link to queues mostly)
  9. webjobsettings
  10. Click the check mark
  11. If it stays on “Running” everything went well.

Edit

You can bypass manually adding FSharp.Core and manually copying it to the output directory by installing the FSharp.Core nuget package.  It appears that there is something going on with the GAC that allows the web job to work locally without the .dll in the output folder, but when you deploy it will not work.  Therefor it must be there.  I prefer to add the FSharp.Core nuget package.

Summary

That’s it!  If you want, you can navigate to this repository, which has a functional web job you can try out: https://github.com/drcrook1/Nerds4Hire Note that you will need to go through all of these steps with this same project.

 

2 thoughts on “Deploying F# Web Job to Azure

  1. Pingback: F# Weekly #8, 2015 | Sergey Tihon's Blog

  2. Pingback: The Morning Brew - Chris Alcock » The Morning Brew #1805

Leave a Reply

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