我正在运行一个名为SmsWebhook
. 它调用外部程序集中的方法,该方法AzureFunctionsSample.Services.dll
引用Newtonsoft.Json 8.0.3
我的详细信息Run.csx
如下:
#r "AzureFunctionsSample.Services.dll"
using System.Net;
using AzureFunctionsSample.Services
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
...
}
在上面的Run()
方法中,我创建了一个实例,并在实例中调用了一个方法。但是,每当我调用该方法时,都会收到以下错误:
2016-05-19T13:41:45 Welcome, you are now connected to log-streaming service.
2016-05-19T13:41:46.878 Function started (Id=64fccf0c-d0ef-45ef-ac1c-7736adc94566)
2016-05-19T13:41:46.878 C# HTTP trigger function processed a request. RequestUri=https://ase-dev-fn-demo.azurewebsites.net/api/smswebhook
2016-05-19T13:41:46.878 Function completed (Failure, Id=64fccf0c-d0ef-45ef-ac1c-7736adc94566)
2016-05-19T13:41:46.894 Exception while executing function: Functions.SmsWebhook. Microsoft.Azure.WebJobs.Script: One or more errors occurred. AzureFunctionsSample.Services: Could not load file or assembly 'Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040).
Newtonsoft.Json.dll
我在目录下手动添加了相同版本的bin
,但仍然得到相同的错误。为什么它在Newtonsoft.Json.dll
档案里抱怨?
顺便说一句,如果我将外部程序集中的所有逻辑都移到 中Run.csx
,它不会抱怨。