azure - 已编译的 Azure 函数,FunctionInitationException : Method not found

标签 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 添加了一条 open 语句。

代码:

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

最佳答案

嗯。这看起来确实很像存在部署问题,因为 MBrace.FsPickler 程序集不可用。我在帖子中知道您的情况,但是您是否 100% 确定该程序集与函数程序集位于同一文件夹中?

它是否在函数运行时/调试器上本地运行? 您运行的是哪个版本的 F#?

关于azure - 已编译的 Azure 函数,FunctionInitationException : Method not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47383091/

相关文章:

javascript - 跨多台机器的 Cypress [Azure Devops]

azure - Windows 服务到 Azure WorkerRoles

azure - 如何使用 PowerShell Az 将 Azure Web 应用与 vnet 关联?

.net - F# System.Random 重复值

syntax - 在 lambda 中调用对象方法的 F# 简写

visual-studio - 无法安装 Azure Functions 扩展

azure - 使用二头肌的 secret 范围角色定义和分配

f# - 在 F# 中编写符合 CLS 的代码

azure - 逻辑应用程序 : Using the "compose" action with an IF statement

python - 在 VS Code 中本地调试多个 Python Azure 函数