Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
发布到Azure后无法将函数参数绑定到TraceWriter类型_Azure_F#_Azure Functions - Fatal编程技术网

发布到Azure后无法将函数参数绑定到TraceWriter类型

发布到Azure后无法将函数参数绑定到TraceWriter类型,azure,f#,azure-functions,Azure,F#,Azure Functions,我遵循指南: 创建的dotnet f#项目:dotnet新类库--语言f#--名称HelloFunctions 添加了对函数的引用:dotnet添加包Microsoft.NET.Sdk.functions 添加了如下文件Library.fs中所述的新函数,添加了配置文件等 编译函数 它通过dotnet build&&dotnet publish&&cd bin/Debug/netstandard2.0/publish&&func start在本地成功启动 将其发布到Azure:func Azur

我遵循指南:

  • 创建的dotnet f#项目:
    dotnet新类库--语言f#--名称HelloFunctions
  • 添加了对函数的引用:
    dotnet添加包Microsoft.NET.Sdk.functions
  • 添加了如下文件Library.fs中所述的新函数,添加了配置文件等
  • 编译函数
  • 它通过
    dotnet build&&dotnet publish&&cd bin/Debug/netstandard2.0/publish&&func start在本地成功启动
  • 将其发布到Azure:
    func Azure functionapp Publish
  • Azure看到了这个功能,它还可以
  • 当我通过单击树中的函数名称导航到该函数时,会弹出错误窗口:

    Function ($Hello) Error: Microsoft.Azure.WebJobs.Host:
    Error indexing method 'Functions.Hello'. Microsoft.Azure.WebJobs.Host:
    Cannot bind parameter 'log' to type TraceWriter. Make sure the parameter Type
    is supported by the binding. 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.).
    
  • 该功能似乎不起作用。也许是因为上面的错误
  • Library.fs

    namespace HelloFunctions
    
    open System
    open Microsoft.Azure.WebJobs
    open Microsoft.Azure.WebJobs.Host
    
    module Say =
    let private daysUntil (d: DateTime) =
        (d - DateTime.Now).TotalDays |> int
    
    let hello (timer: TimerInfo, log: TraceWriter) =
        let christmas = new DateTime(2017, 12, 25)
    
        daysUntil christmas
        |> sprintf "%d days until Christmas"
        |> log.Info
    

    听起来很像程序集版本冲突(运行时运行Microsoft.Azure.WebJobs.Host.dll的一个版本,而您的应用程序引用了另一个版本)


    我的猜测是,您使用运行时版本2.0编译了本地应用程序,而Azure Function应用程序配置为1.0(默认)。请检查。

    听起来很像程序集版本冲突(运行时运行Microsoft.Azure.WebJobs.Host.dll的一个版本,而您的应用程序引用了另一个版本)


    我的猜测是,您使用运行时版本2.0编译了本地应用程序,而Azure Function应用程序配置为1.0(默认)。请检查。

    不兼容的库版本:程序集是根据与函数框架使用的.NET版本不同的.NET版本编译的。不兼容的库版本:程序集是根据与函数框架使用的.NET版本不同的.NET版本编译的。