2

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?

JemHah
  • 434
  • 4
  • 16

1 Answers1

3

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.

Ankit Kumar
  • 488
  • 2
  • 8
  • I am using dotnet publish -c Release --publish-local-settings command but seems this is not valid? – JemHah Feb 27 '19 at 05:55
  • @MahHem apologies, that (--publish-local-settings) is applicable when publishing via `azure-functions-core-tools`. So, if you do `func azure functionapp publish `. I assumed you had `func` installed because of the presence of `local.settings.json`. Or, if you would rather not publish your app using that command and would still like to update settings, you could do `func azure functionapp publish --publish-settings-only`. – Ankit Kumar Feb 28 '19 at 06:33