编译的Azure函数,FunctionInvocationException:找不到方法

时间:2017-11-19 23:21:38

标签: azure f# azure-functions

我编译的Azure函数没有在函数调用的DLL调用的DLL中找到方法。

Microsoft.Azure.WebJobs.Host.FunctionInvocationException : Exception while executing function: Functions.CompiledTrigger 
    ---> System.AggregateException : One or more errors occurred. 
    ---> Method not found: 'Void MBrace.FsPickler.BinarySerializer..ctor(Microsoft.FSharp.Core.FSharpOption`1<Boolean>, Microsoft.FSharp.Core.FSharpOption`1<MBrace.FsPickler.ITypeNameConverter>, Microsoft.FSharp.Core.FSharpOption`1<MBrace.FsPickler.IPicklerResolver>)'.

   at Microsoft.Azure.WebJobs.Script.Description.DotNetFunctionInvoker.GetTaskResult(Task task) 
   at C:\projects\azure-webjobs-sdk-script\src\WebJobs.Script\Description\DotNet\DotNetFunctionInvoker.cs : 453

   at Microsoft.Azure.WebJobs.Script.Description.DotNetFunctionInvoker.<>c.<InvokeCore>b__26_0(Task t) 
   at C:\projects\azure-webjobs-sdk-script\src\WebJobs.Script\Description\DotNet\DotNetFunctionInvoker.cs : 276

   at System.Threading.Tasks.ContinuationResultTaskFromTask`1.InnerInvoke()

   at System.Threading.Tasks.Task.Execute()

   ...

存在所有必需的DLL。该方法存在。我还为子DLL添加了一个开放语句。

代码:

module Trigger

open System
open Microsoft.Azure.WebJobs
open Microsoft.Azure.WebJobs.Host
open Microsoft.Azure.WebJobs.Extensions
open PSlogger             //this DLL is called            
open MBrace.FsPickler     //which calls this DLL


let logMessage (initLog : CountingLog) connString curretnProcess message addlInfo  =

    // fails inside this call, whether I use the async or non-async function
    //IO.insertAsync connString {initLog.Log with 
    IO.insert connString {initLog.Log with 
                                UtcTime = DateTime.UtcNow;
                                Process = curretnProcess
                                Message = message
                                StringInfo = addlInfo
                                } "MyLogPrefix"

let Run(myTimer: TimerInfo, log: TraceWriter ) =
    async {
        ...

        logMessage logger connString None "starting run" None |> ignore

        ...

    } |> Async.StartAsTask

2 个答案:

答案 0 :(得分:1)

嗯。这看起来非常像部署问题,因为MBrace.FsPickler程序集不可用。我在帖子中认识你,但你是否100%确定程序集与函数程序集在同一个文件夹中?

它是在函数运行时/调试器上本地运行的吗? 你在运行什么版本的F#?

答案 1 :(得分:1)

问题是Azure功能无法支持FsPickler.dll,因为DLL是为.NET Framework 4.5构建的,或者是因为System.Tuple在FsPickler下面发生了变化。 See discussion here