I have a function in .Net standard 2.0:
[FunctionName("A_Test")]
public static async Task<string> Test(ILogger log, ExecutionContext context)
{
log.LogInformation("test");
return "hello";
}
according to this article: https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local section "Non-HTTP triggered functions"
"For all kinds of functions other than HTTP triggers and webhooks, you can test your functions locally by calling an administration endpoint. Calling this endpoint with an HTTP POST request on the local server triggers the function. You can optionally pass test data to the execution in the body of the POST request. This functionality is similar to the Test tab in the Azure portal.
You call the following administrator endpoint to trigger non-HTTP functions:"
http://localhost:{port}/admin/functions/{function_name}
I should be able to test non-http triggered functions by using:
curl --request POST -H "Content-Type:application/json" --data '{}' http://localhost:7071/admin/functions/A_Test -v
However when running as debug, all I get is a 400 error:
[08/03/2019 12:59:08] Host lock lease acquired by instance ID '000000000000000000000000BED482F9'.
[08/03/2019 12:59:09] Executing HTTP request: {
[08/03/2019 12:59:09] "requestId": "6dba82a1-65bf-4e10-bcc2-1e7ecdb3524c",
[08/03/2019 12:59:09] "method": "POST",
[08/03/2019 12:59:09] "uri": "/admin/functions/A_Test"
[08/03/2019 12:59:09] }
[08/03/2019 12:59:10] Executed HTTP request: {
[08/03/2019 12:59:10] "requestId": "6dba82a1-65bf-4e10-bcc2-1e7ecdb3524c",
[08/03/2019 12:59:10] "method": "POST",
[08/03/2019 12:59:10] "uri": "/admin/functions/A_Test",
[08/03/2019 12:59:10] "identities": [
[08/03/2019 12:59:10] {
[08/03/2019 12:59:10] "type": "WebJobsAuthLevel",
[08/03/2019 12:59:10] "level": "Admin"
[08/03/2019 12:59:10] },
[08/03/2019 12:59:10] {
[08/03/2019 12:59:10] "type": "WebJobsAuthLevel",
[08/03/2019 12:59:10] "level": "Admin"
[08/03/2019 12:59:10] }
[08/03/2019 12:59:10] ],
[08/03/2019 12:59:10] "status": 400,
[08/03/2019 12:59:10] "duration": 614
[08/03/2019 12:59:10] }
Why?