Azure Functions isolated .net 8 serving content URL for Time Triggered and Service Bus triggered functions(Working fine with .Net6)
We have service bus triggered functions and Time triggered functions which we have moved to Azure Kubernetes workloads was working fine with .Net6
After moving to .Net 8 isolated worker function we are seeing below logs on container ->
Hosting environment: Production Content root path: /azure-functions-host Now listening on: http://[::]:5000 Application started. Press Ctrl+C to shut down.
As part of moving to .net8 we have made below updates
csProj Changes
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<OutputType>Exe</OutputType>
<ImplicitUsings>enabled</ImplicitUsings>
<Nullable>enable</Nullable>
<FunctionsEnableWorkerIndexing>false</FunctionsEnableWorkerIndexing>
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.20.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.1.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.3.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.16.4" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.21.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.1.0" />
</ItemGroup>
<ItemGroup>
<Using Include="System.Threading.ExecutionContext" Alias="ExecutionContext" />
</ItemGroup>
Docker File -
FROM mcr.microsoft.com/dotnet/sdk:8.0-preview AS installer-env
ARG BUILD_CONFIGURATION=Release
ARG user=appuser
ARG group=appuser
ARG uid=1000
ARG gid=1000
RUN addgroup --gid 1000 myusergroup && adduser --uid 1000 --ingroup myusergroup myuser
WORKDIR /src
COPY ["nuget.config", "."]
COPY ["src/Functions/Function.csproj", "src/Functions/FunctionName/"]
ARG FEED_URL
ARG PAT
ENV COMPlus_EnableDiagnostics=0
# download and install latest credential provider.
RUN wget -qO- https://aka.ms/install-artifacts-credprovider.sh | bash
# Optional: Sometimes the http client hangs because of a .NEt issue. Setting this in dockerfile helps
ENV DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0
RUN dotnet restore "./src/Functions/Function.csproj" -s ${FEED_URL} -s https://api.nuget.org/v3/index.json --configfile "nuget.config"
COPY . .
WORKDIR "/src//Functions/Function"
RUN dotnet build "./Function.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM installer-env AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./Function.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM mcr.microsoft.com/azure-functions/dotnet-isolated:4-dotnet-isolated8.0 AS base
WORKDIR /home/site/wwwroot
COPY --from=publish /app/publish .
# To enable ssh & remote debugging on app service change the base image to the one below
# FROM mcr.microsoft.com/azure-functions/dotnet-isolated:4-dotnet-isolated8.0-appservice
FROM base
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
thanks for reporting please share the func name,timestamp ,region and share the repro steps.Thanks
thanks for reporting please share the func name,timestamp ,region and share the repro steps.Thanks
FuncName -
public class ServiceBusFunction
{
[Function("ServiceBusFunction")]
public void Run([TimerTrigger("0/10 * * * * *")] TimerInfo myTimer)
{
Console.WriteLine("Worker function");
}
}
Region - west US2 Repro steps -
Create a .Net8 based isolated time trigger function. Create docker file and push to ACR Pull image from ACR and deploy to AKS container You will see the message - Hosting environment: Production Content root path: /azure-functions-host Now listening on: http://[::]:5000 Application started. Press Ctrl+C to shut down.
@kshyju please comment.Thanks
@rahul-neudesic Can you elaborate what specifically is not working and what is your expected behavior? Please update the post and title to reflect it as needed.
@kshyju We are facing similar issue and function is not able to startup. We have raised an issue for this https://github.com/Azure/azure-functions-host/issues/10413 but our function inproc instead of isolated model. Please let me know if you require more information?