Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to publish a .net core web api to azure functions?

I've recently switched jobs from a AWS shop to an Azure shop, both using dotnet. AWS publishes Amazon.Lambda.AspNetCoreServer, which is a magic Nuget package that allows you to write a plain ol' ASP.NET core Web API and deploy it as into a lambda with only a few lines on config. I really loved this pattern because it allows developers to just write a normal web api without having the host runtime leak into their coding.

Does anything like this exist in Azure? Even something that is community supported? Or is there some any way to achieve something like this in Azure Functions?

like image 669
Mike Pennington Avatar asked Nov 30 '25 02:11

Mike Pennington


1 Answers

Unfortunately there is no simple way to do that since Azure function format is a bit different.

[FunctionName(nameof(GetAll))]
public IActionResult GetAll([HttpTrigger("get", Route = "entity")]HttpRequest request)

Then it will generate json with meta data for AF.

If you wish to host pure .net core without any changes I would look into Containers option

PS0: Theoretically it would be possible to do it with little bit of reflection. For instance you create project with all your Asp.Net core apis, which you can use in asp.net core hosting. Then you write tool which grabs your dll and using reflection you find all actions in your controllers and generate code for AF

PS1: Have a look https://github.com/tntwist/NL.Serverless.AspNetCore

like image 65
Vova Bilyachat Avatar answered Dec 02 '25 18:12

Vova Bilyachat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!