Why am I getting 404 when I run my Azure Function locally?
I have set up a very simple Azure Function in C # for the answer to HttpTrigger
. When I run the function locally following the Microsoft Azure instruction , all I get is an empty 404 response.
I am using Visual Studio 2017 v15.3 Preview with . This is the code for my Azure Function:
[FunctionName("Func1")]
public static async Task<object> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, WebHookType = "genericJson")]
HttpRequestMessage req,
TraceWriter log)
{
return req.CreateResponse(HttpStatusCode.OK);
}
When I run it locally (by right clicking the VS project and going to Debug> Start New Instance) it seems to start just fine. My function is recognized and the URL is http: // localhost: 7071 / api / Func1
However, when I receive or send a message to the above URL (with the Content-Type header set to "application / json"), I return an empty 404 response. The Azure CLI Console outputs:
[6/12/2017 12:26:12 PM] Making HTTP request: {
[6/12/2017 12:26:12 PM] "requestId": "ae247ea6-c055-40f5-a09c-40ea207cc785",
[6/12/2017 12:26:12 PM] "method": "GET",
[6/12/2017 12:26:12 PM] "uri": "/ api / Func1"
[6/12/2017 12:26:12 PM]}
[6/12/2017 12:26:12 PM] Completed HTTP request: {
[6/12/2017 12:26:12 PM] "requestId": "ae247ea6-c055-40f5-a09c-40ea207cc785",
[6/12/2017 12:26:12 PM] "method": "GET",
[6/12/2017 12:26:12 PM] "uri": "/ api / Func1",
[6/12/2017 12:26:12 PM] "authorizationLevel": "Anonymous"
[6/12/2017 12:26:12 PM]}
[6/12/2017 12:26:12 PM] Answer details: {
[6/12/2017 12:26:12 PM] "requestId": "ae247ea6-c055-40f5-a09c-40ea207cc785",
[6/12/2017 12:26:12 PM] "status": "NotFound"
[6/12/2017 12:26:12 PM]}
Why am I getting 404 and how can I fix it?
source to share