.NET 3.1 function app does not work after pipeline deployment

Kirill Iuferev 1 Reputation point
2022-11-28T11:14:59.763+00:00

I have a .NET 3.1 application deployed to Azure Functions as ZIP archive. I’m using Azure Pipelines to build, pack and upload the project code. Several months ago, everything was working fine. I was able to build code and upload my application to Azure Functions. However, a couple of months ago Azure Function has stopped working with my application.

I’m still able to successfully build and upload code to Azure Function, but the Function itself does not run the code as expected. When trying to browse the Function instead of “Your Function App is up and runnning” I’m getting “Function host is not running”. There is also an error in Overview section and in the Log stream for this Function App:

FunctionMonkey: ReflectionTypeLoadException: Unable to load one or more of the requested types.   
Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Abstractions, Version=3.1.31.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.  
<same lines omitted>  
Unable to load types:   
<application functions omitted>  
null type in ReflectionTypeLoadException  
<same lines omitted>  
With errors: FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Abstractions, Version=3.1.31.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.  

However, if I try to build, pack and upload the same code from my Visual Studio Code, the Function works fine and as expected.

I’ve tried several things to fix this:

  1. Change Azure agent vmImage version. Currently application is built on windows-2022 agent. I’ve changed the version to windows-2019 but it didn’t help with the issue.
  2. Change build procedure. I’ve tried to build my application with “dotnet publish” command instead of “dotnet restore -> dotnet build” but no luck.
  3. Force usage of .NET 3.1 SDK instead of default .NET 6.0. I’ve noticed that Azure agent uses .NET 6.0 SDK to build my application, so I’ve tried to change it by adding a new step to my pipeline which installs .NET 3.1 SDK on an agent. But even built with .NET 3.1 SDK my application was not working properly.
  4. Install “missing” package. I’ve tried to fix the issue by installing “Microsoft.AspNetCore.Mvc.Abstractions” package on an agent, but it didn’t help. Please note that this package is not mentioned in my csproj file. However, “FunctionMonkey.Abstractions” is present in the project file.
  5. Install site extensions. I’ve tried to install different versions of .NET SDK extension to my function app using SCM endpoint but none of them helped with the issue.

There were no drastic changes to the application code or build procedure. Version 3 of Azure Function App is used in my setup. I’ve read about EOL changes for .NET 3.0 and Azure Functions v3, but right now migrating my project to .NET 6.0 and Azure Functions v4 is complicated.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,235 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Kirill Iuferev 1 Reputation point
    2023-02-07T14:16:38.8666667+00:00

    Looks like the problem solved itself. I'm no longer experiencing this issue.

    0 comments No comments