次の方法で共有


Deploying F# Web Job to Azure

Hi All,

This is another pull from my blog over at: www.indiedevspot.com

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 https://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.

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.