Я получаю
2020-04-21T15:15:58.686 [Information] Executing 'Functions.entry' (Reason='This function was programmatically called via the host APIs.', Id=90808c2e-1944-454c-bac0-e25871662d7c)
2020-04-21T15:15:59.192 [Error] Executed 'Functions.entry' (Failed, Id=90808c2e-1944-454c-bac0-e25871662d7c)
Not Found
2020-04-21T15:17:28 No new trace in the past 1 min(s).
Функция. json
{
"bindings": [
{
"authLevel": "anonymous",
"name": "req",
"type": "httpTrigger",
"direction": "in",
"methods": [
"get",
"post"
]
},
{
"name": "$return",
"type": "http",
"direction": "out"
},
{
"type": "table",
"name": "entryTableOutput",
"tableName": "entry",
"connection": "AzureWebJobsStorage",
"direction": "out"
},
{
"type": "table",
"name": "entryTableInput",
"tableName": "entry",
"take": 50,
"connection": "AzureWebJobsStorage",
"direction": "in"
}
],
"disabled": false
}
Это мой код, есть идеи?
Run.CSX
#r "Newtonsoft.Json"
#r "Microsoft.WindowsAzure.Storage"
using System.Net;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Table;
using Newtonsoft.Json;
public static async Task<IActionResult> Run(HttpRequest req, Newtonsoft.Json.Linq.JArray entryTableInput, IAsyncCollector<Entry> entryTableOutput, ILogger log)
{
log.LogInformation(req.Method);
if (req.Method == "GET")
{
return (ActionResult) new OkObjectResult(entryTableInput);
}
var requestBody = await new StreamReader(req.Body).ReadToEndAsync();
var entry = JsonConvert.DeserializeObject<Entry>(requestBody);
if (entry != null)
{
await entryTableOutput.AddAsync(entry);
return (ActionResult) new OkObjectResult(entry);
}
return new BadRequestObjectResult("Invalid entry request.");
}
public class Entry
{
public string Id => Guid.NewGuid().ToString("n");
public string Title { get; set; }
public double Latitude { get; set; }
public double Longitude { get; set; }
public DateTime Date { get; set; }
public int Rating { get; set; }
public string Notes { get; set; }
// Required for Table Storage entities
public string PartitionKey => "ENTRY";
public string RowKey => Id;
}