Thursday, 15 January 2015

[I WISH] Getting started with Azure WebJobs and Storage Emulator

I've written this post to bring together all the various resources I used to get a Azure WebJob built which utilized the Azure Storage Emulator.

1. Make sure you the have Azure SDK installed, which should install the Azure Storage Emulator (amoungst many other things including Visual Studio 2013 Express for Web if you've not already got VS2013) - see here:

http://go.microsoft.com/fwlink/?linkid=324322&clcid=0x409

2. Download teh complete solution of the 'Get started with the Azure WebJobs SDK' tutorial:

http://code.msdn.microsoft.com/Simple-Azure-Website-with-b4391eeb

3. Open up the solution and build it - this should restore all the packages. If it doesn't restore them manually by going to the Manage NuGet Packages for Solution dialog and clicking the Restore button at the top right.

4. Configure the ContosoAdsWeb project to use Emulated Storage:
- Open the web.config file of the ContosoAdsWeb project
- Add another connection string like:

<add name="EmulatedStorage" connectionString="UseDevelopmentStorage=true" />

5. In global.asax.cs, set the storageAccount variable to use the 'EmulatedStorage' connection string like this:

var storageAccount = CloudStorageAccount.Parse
                (ConfigurationManager.ConnectionStrings["EmulatedStorage"].ToString());

6. Configure teh ContosoAdsWebJob project to user Emulated Storage:
- Open the app.config of the ContosoAdsWebJob project
- Comment out the existing connection strings and add the following:


    <add name="AzureWebJobsDashboard" connectionString="UseDevelopmentStorage=true"/>
    <add name="AzureWebJobsStorage" connectionString="UseDevelopmentStorage=true"/>

**** It was at this point I got an exception stating that Storage Emulator is not supported with WebJobs ****

No comments:

Post a Comment