1
votes

I am using azure table storage for saving data. And I want to create the method as azure function. When i locally debug, it's work fine. When add it in azure function, I got exception error

Method not found: 'Boolean Microsoft.WindowsAzure.Storage.Table.CloudTable.CreateIfNotExists.

CloudTableClient tableClient = cloudStorageAccount.CreateCloudTableClient();
            if (tableClient != null)
            {
                CloudTable table = tableClient.GetTableReference(reference);
                table.CreateIfNotExists();
                TableOperation insertOperation = TableOperation.Insert(entity);
                table.Execute(insertOperation);
                return true;
            }

And WindowsAzure.Storage package config,

<package id="WindowsAzure.Storage" version="7.2.1" targetFramework="net461" />
1
did you create the storage in Azure? did you configure the storage connetionstring in app settings of the azure function?Anass Kartit
yes, created. And it's working fine in local. And connection string hard coded, but not working.Jinesh
Could you be deploying a v1 function app that you're building locally onto a v2 function app in the cloud? Even our earliest Storage extensions for v2 depended on Storage 9.3.1. My guess is that CreateIfNotExists() went away and became CreateIfNotExistsAsync().brettsam
Changed CreateIfNotExists() to CreateIfNotExistsAsync(), now got another error Method not found: 'Microsoft.WindowsAzure.Storage.Table.TableResult Microsoft.WindowsAzure.Storage.Table.CloudTable.Execute.Jinesh
table.Excute receives three parameters as described in here docs.microsoft.com/en-us/dotnet/api/…Anass Kartit

1 Answers

0
votes

Update the nuget to WindowsAzure.Storage 9.3.3 https://www.nuget.org/packages/WindowsAzure.Storage/ then publish your function it should work , make sure the connection string is configured in app settings.