Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

local.settings.json is not part of "publish" folder and deployment is unsuccessful

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?

like image 232
JemHah Avatar asked Dec 03 '25 13:12

JemHah


1 Answers

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.

like image 97
Ankit Kumar Avatar answered Dec 05 '25 08:12

Ankit Kumar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!