2017-09-26 1 views
0

.NETクラスライブラリを関数Appとして公開すると、コンパイル済みのバージョンにAzure関数Appを変換しようとしています。 'blog post from Donna Malayeriコンパイル済みのAzure関数StorageTableInputバインディングが機能しない

私が使用するタイマートリガには、型付きオブジェクトを使用してStorageTable入力バインディングがあります。オブジェクトは 'TableEntity'から継承します。ポータルでのバージョンはすべての問題を持っていませんが、私のコンパイル済みのバージョンは、次のエラーがスローされます。

using System; 
using System.Linq; 
using Microsoft.Azure.WebJobs; 
using Microsoft.Azure.WebJobs.Host; 
using Microsoft.WindowsAzure.Storage.Table; 

namespace MyScheduler 
{ 
    public class ScheduleTrigger 
    { 

     public static void Run(TimerInfo scheduleTimer, Queryable<Schedule> schedulesTable, ICollector<Schedule> scheduleQueueItem, TraceWriter log) 
     { 
      log.Info($"Start processing at: {DateTime.Now}."); 

      // processing code here... 

      log.Info($"Finished processing at: {DateTime.Now}."); 
     } 
    } 

    public class Schedule : TableEntity 
    { 
     public string Name { get; set; } 
     public DateTime LastRunAt { get; set; } 
     public bool Active { get; set; } 
     public string Endpoint { get; set; } 
    } 
} 

function.json」:

Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.ScheduleTrigger'. Microsoft.Azure.WebJobs.Host: GenericArguments[0], 'MyScheduler.Schedule', on 'Microsoft.Azure.WebJobs.Host.Tables.TableExtension+TableToIQueryableConverter`1[TElement]' violates the constraint of type 'TElement'. mscorlib: GenericArguments[0], 'MyScheduler.Schedule', on 'Microsoft.Azure.WebJobs.Host.Tables.TableExtension+TableToIQueryableConverter`1[TElement]' violates the constraint of type parameter 'TElement'. 

Azureの機能コードは次のようになりますファイルには、次のようになります。

{ 
    "scriptFile": "..\\bin\\MyScheduler.dll", 
    "entryPoint": "MyScheduler.ScheduleTrigger.Run", 
    "bindings": [ 
    { 
     "name": "scheduleTimer", 
     "type": "timerTrigger", 
     "direction": "in", 
     "schedule": "0 * * * * *" 
    }, 
    { 
     "type": "table", 
     "name": "schedulesTable", 
     "tableName": "schedules", 
     "partitionKey": "Schedules", 
     "connection": "AzureWebJobsStorage", 
     "direction": "in" 
    }, 
    { 
     "type": "queue", 
     "name": "scheduleQueueItem", 
     "queueName": "schedulesqueue", 
     "connection": "AzureWebJobsStorage", 
     "direction": "out" 
    } 
    ], 
    "disabled": true 
} 
+0

どのバージョンのStorage SDKを参照していますか? –

答えて

1

物事のカップル:

  1. あなたはAzureストレージSDK 7.2.1以下(理想的には、7.2.1)は
  2. 、プリコンパイルされた関数の最新モデル、フルツール/ Visual Studioの統合で、文書化されてhereを参照していることを確認します。それに切り替えてみてください。
+0

私はhttps://stackoverflow.com/questions/42284705/precompiled-azure-function-and-cloudtable-binding-output-doesnt-workのあなたの他の答えを見ましたが、これは全く同じ問題ではありませんでした。実際にそれを試してください。 –

+0

また、答えは1年以上前からのものでした...あなたは今のところそれが解決されると期待しています –

+0

これは助けてくれてうれしいです。新しいバージョンへの移行は、マイナーバージョンのリリースでは行われませんので、1.xでは変更されません。 2.0プレビューは最新のバージョンを使用しており、この制限を緩和する仕組みを公開しようと考えています。 –

関連する問題