2017-10-23 54 views
1

私は、Visual Studioツールを使用している関数入力バインドで奇妙な問題を抱えています。これは正常に動作し、私が欲しいデータを取得Azure関数での奇妙な衝突

[FunctionName("Scaling")] 
    public static HttpResponseMessage Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = "HttpTriggerCSharp/name/{name}")]HttpRequestMessage req, string name, [Table("scalingdatawesteurope", Connection = "scalingdataStorage")]CloudTable scalingDataTable, TraceWriter log) 
    { 
     log.Info("C# HTTP trigger function processed a request."); 
     var customerScaleData = GetScaleData(name, scalingDataTable); 
     log.Info("Sub:" + customerScaleData.Subscription); 
     // Fetching the name from the path parameter in the request URL 
     return req.CreateResponse(HttpStatusCode.OK, "Hello " + name); 
    } 

:私は、HTTPトリガーとテーブル格納用のバインディングを入力した簡単な関数を作成しました。しかし、今私がやりたいことは、このデータを使用して、ARM APIを使用して他のAzureリソースに対していくつかの操作を実行することです。ですから、Microsoft.Azure.Management.FluentパッケージをNugetでインポートして、これを行うことができます。このパッケージをインポートして依存関係として追加すると、私の関数は失敗します。私がそれを取り除くと、それはすべて再び働く。

[23/10/2017 12:23:14] A ScriptHost error has occurred 
[23/10/2017 12:23:14] Microsoft.Azure.WebJobs.Host: Error indexing method 'Scaling.Run'. Microsoft.Azure.WebJobs.Host: Can't bind Table to type 'Microsoft.WindowsAzure.Storage.Table.CloudTable'. 
[23/10/2017 12:23:14] Error indexing method 'Scaling.Run' 
[23/10/2017 12:23:14] Microsoft.Azure.WebJobs.Host: Error indexing method 'Scaling.Run'. Microsoft.Azure.WebJobs.Host: Can't bind Table to type 'Microsoft.WindowsAzure.Storage.Table.CloudTable'. 
[23/10/2017 12:23:14] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.). 
[23/10/2017 12:23:14] Job host started 
[23/10/2017 12:23:14] The following 1 functions are in error: 
[23/10/2017 12:23:14] Run: Microsoft.Azure.WebJobs.Host: Error indexing method 'Scaling.Run'. Microsoft.Azure.WebJobs.Host: Can't bind Table to type 'Microsoft.WindowsAzure.Storage.Table.CloudTable'. 
[23/10/2017 12:23:14] 
[23/10/2017 12:23:14] 
[23/10/2017 12:23:14] Host lock lease acquired by instance ID '000000000000000000000000F195573C'. 
Debugger listening on [::]:5858 

ここには何らかの矛盾があるようですが、私はそれを見つけたり修正したりするのに苦労しています。

+0

使用しているストレージSDKのバージョンは何ですか? https://stackoverflow.com/questions/42284705/precompiled-azure-function-and-cloudtable-binding-output-doesnt-work – DavidG

答えて

1

Microsoft.Azure.Management.ContainerInstance.Fluentは、8.1.4WindowsAzure.Storageの依存関係を持ち、関数ランタイムは7.2.1です。

バージョンの競合に関する問題の詳細については、this github issueのAzure関数を参照してください。

しかし、最も簡単な修正は、傘Microsoft.Azure.Management.Fluent(したがってContainerInstance.Fluent)を使用するのではなく、明示的に必要なサブライブラリのみを参照することです。

UPDATE:

あなたが言及したよう

、あなたはおそらく、親のlibからAuthenticateコールのサブライブラリーを使用することはできません。

私が今までに見つけた唯一の回避策は、8.xバージョンのWindowsAzure.Storageが使用されている2.0ランタイムのベータ版に切り替えることです。

+0

を参照してください。Microsoft.Azure.Management.Compute.Fluentだけをインポートして、多くの問題を解決します私の依存関係の中には、Microsoft.Azure.Management.Fluentを必要とするAzure.Authenticate(資格情報)の部分が1つ残っています。私はちょうどそれをインポートする方法を見つけることができないすべてのサブパッケージを取得することなく、その後、物事を壊す。 –

+0

はい、確かに、私は 'Authenticate'の部分を考えていませんでした... – Mikhail

+0

私はあきらめてしまい、REST APIを使って正常に動作しました。この依存関係の問題のように見えるのは、関数にとってはかなり大きな問題です。とにかく、正解に感謝してくれました。 –

関連する問題