HttpTrigger属性的方法属性不会填充function.json

时间:2018-01-08 16:52:25

标签: f# azure-functions

HttpTrigger属性的Methods属性不会填充function.json

[<FunctionName("HttpFunc")>]
let run([<HttpTrigger(AuthorizationLevel.Anonymous, Route = "hellosanta", Methods = [|"get"|])>] req: HttpRequest, log: TraceWriter) =

导致以下function.json

{
  "generatedBy": "Microsoft.NET.Sdk.Functions.Generator-1.0.7",
  "configurationSource": "attributes",
  "bindings": [
    {
      "type": "httpTrigger",
      "route": "hellosanta",
      "methods": [],
      "authLevel": "anonymous",
      "name": "req"
    }
  ],
  "disabled": false,
  "scriptFile": "../bin/HttpFunc.dll",
  "entryPoint": "HttpFunc.PrecompiledHttp.run"
}
  

Microsoft.NET.Sdk.Functions(1.0.7)

     

(WebJobs的多个版本显示在依赖图中)

     

Microsoft.Azure.WebJobs(2.1.0-beta4) - 限制:|| (== net47)(&amp;&amp;   (== netstandard2.0)(&gt; = net46))

     

Microsoft.Azure.WebJobs(3.0.0-beta4) - 限制:|| (&amp;&amp;(== net47)   (&lt; net46)(&gt; = netstandard2.0))(== netstandard2.0)

     

Microsoft.Azure.WebJobs.Extensions(2.1.0-beta4) - 限制:|| (==   net47)(&amp;&amp;(== netstandard2.0)(&gt; = net46))

     

Microsoft.Azure.WebJobs.Extensions(3.0.0-beta4) - 限制:|| (安培;&安培;   (== net47)(&lt; net46)(&gt; = netstandard2.0))(== netstandard2.0)

     

Microsoft.Azure.WebJobs.Extensions.Http(1.0.0-beta4) - 限制:   || (== net47)(&amp;&amp;(== netstandard2.0)(&gt; = net46))

     

Microsoft.Azure.WebJobs.Extensions.Http(3.0.0-beta4) - 限制:   || (&amp;&amp;(== net47)(&lt; net46)(&gt; = netstandard2.0))(== netstandard2.0)

还向https://github.com/Azure/Azure-Functions/issues/645

报告了这一情况

1 个答案:

答案 0 :(得分:2)

我有点疑惑为什么你的代码甚至会编译,因为Methods有一个私有的setter ...

无论如何,以下内容对我有用:

[<HttpTrigger(AuthorizationLevel.Anonymous, [|"get"|], Route = "hellosanta")>]

或只是

[<HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "hellosanta")>]