I create a new project with an Azure Function in .NET 8. In my local.settings.json file, I create a time trigger like this:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
"TimerTrigger": "0 59 23 * * * *",
}
}
My Azure Function uses the TimerTrigger value:
public async Task Run([TimerTrigger("%TimerTrigger%", RunOnStartup = true)] TimerInfo myTimer)
{ ... }
And my Program.cs looks like this:
var builder = new HostBuilder();
builder.ConfigureFunctionsWebApplication();
builder.Build().Run();
I tried to run it in debug mode, but I always get this error:
Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.Test'. Microsoft.Azure.WebJobs.Host: '%TimerTrigger%' does not resolve to a value.
What I found is that my local.settings.json is different in my bin/debug folder and looks like this:
{
"IsEncrypted": true,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "################################"
}
}
My file is set to be copied if newer, but, also with copy always, it lost my configuration.
But, when I start the application, settings are copied well. The problems seems related to this prompt on startup:
I choose isolated worker model. Is this my error? Where is the problem?
My csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.24.0" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.23.0" />
<!-- Application Insights isn't enabled by default. See https://aka.ms/AAt8mw4. -->
<!-- <PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" /> -->
<!-- <PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="2.0.0" /> -->
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.3.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.4" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.4" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Using Include="System.Threading.ExecutionContext" Alias="ExecutionContext" />
</ItemGroup>
</Project>
SOLVED
The problem was in my local.settings.json. It contains some other configurations in JSON format and that cause the issue. I changed this part with single level property. In this way prompt disappear and all works fine.

"BlobStorageConfig": { "param": "val" }. This causes the issue. Changed to"BlobStorageConfig:Param": "val"and now it works!