简体   繁体   中英

Azure Function Deployment failing because function.json is wrong

When I deploy an Azure Function from Visual Studio, the function.json file is always incorrect. An example of the function.json file is the following for a queue triggered function:

{
  "generatedBy": "Microsoft.NET.Sdk.Functions-1.0.12",
  "configurationSource": "attributes",
  "bindings": [
{
  "type": "queueTrigger",
  "connection": "AzureWebJobsStorage",
  "queueName": "queue",
  "name": "myQueueItem"
}
],
  "disabled": false,
  "scriptFile": "../bin/x.dll",
  "entryPoint": "x"
}

The correct function.json in order for the function to work in azure is:

{
      "bindings": [
{
  "type": "queueTrigger",
  "connection": "AzureWebJobsStorage",
  "direction" : "in",
  "queueName": "queue",
  "name": "myQueueItem"
}
],
  "disabled": false,
  "scriptFile": "../bin/x.dll",
  "entryPoint": "x"
}

Is there any solution to automated deployments/ Visual Studio deployments that would do this automatically? Currently I am editing all the function.json files every deployment. Any solutions or workarounds would be appreciated.

Agree with @Thomas, have tested v1 queue trigger template with Microsoft.NET.Sdk.Functions-1.0.12 and latest Microsoft.NET.Sdk.Functions-1.0.22 , function.json generated by VS does work.

Actually two function.json both work on Azure, those two line below are used to tell function.json is generated by VS and not recommended to be modified after deployment.

"generatedBy": "Microsoft.NET.Sdk.Functions-1.0.22",
"configurationSource": "attributes",

The first one would not work

Function execution result may not be shown instantly, you could go to https://functionappname.scm.azurewebsites.net/DebugConsole and navigate to D:\\home\\LogFiles\\Application\\Functions\\function\\{FunctionName} to check log files.

Also you can visit D:\\home\\LogFiles\\Application\\Functions\\Host to detect detailed host logs.

If you are still troubled, you could elaborate would not work with details and show us your code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM