I'm trying to create a new Azure Function in Visual Studio, but I'm encountering an issue. When I attempt to create the function, instead of the Azure Function icon, it displays the C# icon. This is preventing me from properly setting up the Azure Function project. Has anyone experienced this issue before? Any solutions or suggestions would be appreciated!
Unhandled exception. System.InvalidOperationException: Configuration is missing the 'HostEndpoint' information. Please ensure an entry with the key 'Functions:Worker:HostEndpoint' is present in your configuration.
I'm trying to create a new Azure Function in Visual Studio, but I'm encountering an issue. When I attempt to create the function, instead of the Azure Function icon, it displays the C# icon. This is preventing me from properly setting up the Azure Function project. Has anyone experienced this issue before? Any solutions or suggestions would be appreciated!
Unhandled exception. System.InvalidOperationException: Configuration is missing the 'HostEndpoint' information. Please ensure an entry with the key 'Functions:Worker:HostEndpoint' is present in your configuration.
Share
Improve this question
edited Mar 18 at 9:32
Tiny Wang
16.5k2 gold badges18 silver badges38 bronze badges
asked Mar 17 at 15:30
Akshay KumarAkshay Kumar
211 silver badge8 bronze badges
11
|
Show 6 more comments
1 Answer
Reset to default 0I got the same error when I created a .NET 8.0 Isolated Azure function using Visual Studio version 17.12.5
.
I have resolved the issue by restarting the system.
Install Azure function core tools latest version.
.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="Microsoft.Azure.Functions.Worker" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.0" />
</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>
local.settings.json:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"
}
}
Able to run the function now:
Azure Functions Core Tools
Core Tools Version: 4.0.6821 Commit hash: N/A +c09a2033faa7ecf51b3773308283af0ca9a99f83 (64-bit)
Function Runtime Version: 4.1036.1.23224
[2025-03-19T12:40:02.797Z] Found C:\Users\uname\Source\Repos\Simplefunction\Simplefunction.csproj. Using for user secrets file configuration.
[2025-03-19T12:40:08.544Z] Azure Functions .NET Worker (PID: 1804) initialized in debug mode. Waiting for debugger to attach...
[2025-03-19T12:40:08.656Z] Worker process started and initialized.
Functions:
Function1: [GET,POST] http://localhost:7142/api/Function1
For detailed output, run func with --verbose flag.
[2025-03-19T12:40:12.809Z] Executing 'Functions.Function1' (Reason='This function was programmatically called via the host APIs.', Id=5ea43064-e352-494a-80ba-885f2464019b)
[2025-03-19T12:40:13.454Z] C# HTTP trigger function processed a request.
[2025-03-19T12:40:13.472Z] Executing OkObjectResult, writing value of type 'System.String'.
[2025-03-19T12:40:13.602Z] Executed 'Functions.Function1' (Succeeded, Id=5ea43064-e352-494a-80ba-885f2464019b, Duration=873ms)
[2025-03-19T12:40:13.895Z] Host lock lease acquired by instance ID '000000000000000000000000F72731CC'.
Functions:Worker:HostEndpoint
inhost.json
. – Dasari Kamali Commented Mar 18 at 6:16func start func host --dotnet-isolated
instead of using the VS Run button. – Dasari Kamali Commented Mar 18 at 6:29Azure development
module? And maybe we can restart the computer. By the way, may I know the .Net version and Function type and VS type so that I could try to reproduce your issue? – Tiny Wang Commented Mar 18 at 8:32Microsoft.Azure.Functions.Worker
. May I know why you haveMicrosoft.NET.Sdk.Functions
reference in your function? I upgraded my VS to 17.13.3 just now and I still can't reproduce your issue. – Tiny Wang Commented Mar 18 at 9:55