I want to debug on my laptop a project with Azure Functions. The language is C#. Few functions are using a connection to a service bus. This project is deployed already on Azure and it is working.
In my new laptop, I have installed Visual Studio 2022 Community (64 bit) - Preview Version 17.5.0 Preview 6.0.
Then, pull the project from the Git repository and when I run the project I get this error
A host error has occurred during startup operation '02312afe-22ad-4fdf-bb10-f4852471c73e'.
Microsoft.Azure.WebJobs.Script: Did not find functions with language [dotnet-isolated].
Visual Studio shows me those lines:
public Task StopAsync()
{
ThrowIfDisposed();
Interlocked.CompareExchange(ref _state, StateStoppingOrStopped, StateStarted);
if (_state != StateStoppingOrStopped)
{
throw new InvalidOperationException("The host has not yet started.");
}
that they are coming from JobHost.cs
(wrote by Microsoft)
Following this post, I tried to install the Azure Functions Core Tools but I get the same error.
The project has the following properties
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<ApplicationInsightsResourceId>/subscriptions/</ApplicationInsightsResourceId>
<UserSecretsId>d9d1dbff-5ee9-4590-ab74-4fbd7c563096</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.21.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.10.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.0.13" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.ServiceBus" Version="5.8.1" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.3" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.ApplicationInsights" Version="1.0.0-preview4" />
<PackageReference Include="PSC.Extensions" Version="6.0.28" />
<PackageReference Include="WB.Domain" Version="1.2.44" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\WB.Api.Client\WB.Api.Client\WB.Api.Client.csproj" />
<ProjectReference Include="..\..\WB.Connections.Reverso\WB.Connections.Reverso\WB.Connections.Reverso.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
I tried to change in the local.settings.json
the value FUNCTIONS_WORKER_RUNTIME
from dotnet-isolated
to powershell
but with the same issue.
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "powershell",
"SBConnectionString": "Endpoint=myconection"
}
}
So, then, I tried to create a new Azure Functions with Visual Studio with NET7. In the wizard I added the Service Bus connection string and the queue. The error is simular
Azurite
If I use the PowerShell to run Azurite
I get an error
When I open the project in Visual Studio I can see