I created a Azure function using .net core 2.0 and core tools. It is a HttpTrigger function. I used
dotnet restore
dotnet publish -c Release
to create the publish files. 2 files and 2 folders I can see in my publish folder under bin/Release/.netcoreapp2.0. These are:
bin
myapi
host.json
namespace.myapi.deps.json
I deployed them on Function App on Azure under 'wwwroot' folder. I keep getting 404 error. Then I also copied local.settings.json file under 'wwwroot' folder and function app url access was a success.
My Query: Why local.settings.json was missing from publish folder? Any parameter missing in my dotnet commands?
Are you sure that the only difference between 404 error and your function success was the absence of local.settings.json
? I ask this because Azure Function App does not depend on or use that file anyhow.
local.settings.json
file is only meant for running your functions locally using azure-functions-core-tools. Ideally, this file should never be published. More information about the file is available here. If you want to sync your local settings with the Azure function app, you can use the flag --publish-local-settings
while publishing using azure-functions-core-tools. Or you can manually add those settings.
You should never have to publish that file.