2017-10-08 23 views
1

CosmosDBグラフに接続するAzure関数を作成しました。私は、Microsoft.Azure.Graph 0.3.0プレビューのnugetパッケージを使用しています。私が関数の終点に達したときにエラーが発生しています。ファイルまたはアセンブリ 'Microsoft.Azure.Graphs'を読み込めませんでした

Exception while executing function: GetTrain -> Could not load file or assembly 'Microsoft.Azure.Graphs, Version=0.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

関数のコードは以下ですが、それも限りと取得していません。

[FunctionName("GetThing")] 
public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Function, "get", Route = "thing/{id}")]HttpRequestMessage req, string id, TraceWriter log) 
{ 
    log.Info("C# HTTP trigger function processed a request."); 

    string endpoint = ConfigurationManager.AppSettings["endpoint"]; 
    string authKey = ConfigurationManager.AppSettings["authkey"]; 
    string db = ConfigurationManager.AppSettings["db"]; 
    string collection = ConfigurationManager.AppSettings["collection"]; 

    DocumentClient client = new DocumentClient(new Uri(endpoint), authKey, 
     new ConnectionPolicy { ConnectionMode = ConnectionMode.Direct, ConnectionProtocol = Protocol.Tcp }); 

    DocumentCollection graph = await client.CreateDocumentCollectionIfNotExistsAsync(
      UriFactory.CreateDatabaseUri(db), 
      new DocumentCollection { Id = collection }, 
      new RequestOptions { OfferThroughput = 1000 }); 


     IDocumentQuery<dynamic> query = client.CreateGremlinQuery<dynamic>(graph, $"g.V('{id}').has('thing')"); 

    // Fetching the name from the path parameter in the request URL 
    return req.CreateResponse(HttpStatusCode.OK, "Hello"); 
} 

更新

は完全にそれを見ていない、ビルド警告があるようです。何かご意見は?警告は、「MSIL」を建設中プロジェクトのプロセッサアーキテクチャおよびC」参照のプロセッサアーキテクチャの間に不一致があったMSB3270

:\ユーザーは\ blah.nugetパッケージ\ \ microsoft.azure.graphs 0.3 \ .0 - プレビュー\ lib \ net461 \ Microsoft.Azure.Graphs.dll "、" AMD64 "。この不一致は、実行時の障害を引き起こす可能性があります。構成マネージャーを使用してプロジェクトの対象プロセッサーアーキテクチャーを変更して、プロジェクトと参照の間でプロセッサーのアーキテクチャーを調整するか、プロジェクトの対象プロセッサーアーキテクチャーと一致するプロセッサーアーキテクチャーを参照に依存させることを検討してください。

+0

また私の側でそれを再現することができました。私たちは[feedback](https://github.com/Azure/Azure-Functions/issues)をazure関数チームに与えることができます –

+0

コンパイル時の警告はありますか? –

+0

はい、警告付きで更新されました –

答えて

1

Microsoft.Azure.Graphsパッケージの0.2.4プレビュー版をお試しください。 0.3.0のリリースに問題があるようです。 SDKのページの最近のコメントを参照してください:

https://docs.microsoft.com/en-us/azure/cosmos-db/graph-sdk-dotnet

をそして私はGitHubの問題を追加しました:

https://github.com/Azure/azure-documentdb-dotnet/issues/361

+0

私のパッケージをダウングレードし、以前よりもうまく動作し始めました。 –

2

この問題は、Microsoft.Azure.Graphs> = 0.3.1-previewのパッケージで解決されます。

他の人も指摘しているように、Microsoft.Azure.Graphsは以前はx64プラットフォームのみをターゲットにしていたという問題がありました。現在、AnyCPU(MSIL)を対象とした新しいバージョンのアセンブリがコンパイルされています。

関連する問題