I'm afraid you can't use the root path to access this function, because https://localhost:7071/ is always the default page of Azure function:

Below are my verification steps, I will change the path of the function to https://localhost:7071/, but it still displays the default page of Azure function app.
By default, the route for your azure function would be localhost:7071/api/{functionName}
You must have noticed by now that almost all the function routes had /api/ in the route. In case, you wanted to change it, you can change it by modifying the content using the host.json.
You need to add "extensions": { "http": { "routePrefix": "" } } in your host.json:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensions": { "http": { "routePrefix": "" } }
}
Now, your route might look like this:
localhost:7071/{functionName}
You also need to set the Route in the code to "".
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "")] HttpRequest req,

The current route should meet your requirements:

But using this path to access this function still fails, so I think it is invalid to set the path of the Azure function as the root path, and you cannot use it to access your Azure function.
If you deploy to Azure portal, you can try to add "AzureWebJobsDisableHomepage ": true in app settings to disable the homepage of Azure function. I tested it locally and it doesn't seem to work. Azure portal seems to work.