none
Running an ASP.NET Core Pipeline using Azure Functions

    Question

  • Azure Functions now supports publishing a class library, which is cool. I currently use an HTTP trigger to invoke a function for all my HTTP requests. By using a catch-all route template, I could get all the HTTP calls routed to a single Azure function. From this function, I run the HttpRequestMessage parameter object through an ASP.NET Core pipeline. This way, I managed to run my ASP.NET Core MVC REST services app on Azure Functions. Basically I could bring the power of ASP.NET Core MVC into functions. I can define controllers and use the routing mechanism and also use good stuff like model binding, content negotiation, etc. without having to define a function for every HTTP call. I could even get Swagger working in this arrangement although it was a bit difficult and I had to take help from Azure proxy. This part is already done and here are my questions.

    (1) Running an ASP.NET Core Web API app on Azure Functions - Is it an acceptable solution or a hacky solution from the perspective of Azure Functions best practices?

    (2) Do you have plans to support a web framework like ASP.NET Core on Azure Functions in the future? I'm not asking about .NET Core support, which I know is on the works.

    (3) I'm using consumption plan. Are there any performance/scalability limitations that I need to be aware of? I'm kind of scared by issues like https://github.com/Azure/azure-webjobs-sdk-script/issues/1206.

    (4) If I access a data source such as SQL server from my Web API (which in turn is going to run inside my one and only function), are there any known issues in terms of opening TCP sockets.

    PS. I'm yet to run any load test on my app.

    Thanks for your time.

    Wednesday, August 9, 2017 3:46 AM

All replies

  • Hi Badril,

    We are doing something similar with WebAPI 2 on Azure Fn and works just fine - although our approach was slightly different than to yours.

    We published a Nuget package that integrates with existing WebAPI solutions with minimal changes - source code isn't available yet but you can check out https://github.com/inuvano-labs/azure-functions-webapiproxy

    Cheers

    Saturday, August 12, 2017 8:08 PM
  • What are you using to run your code through the core pipeline?
    Sunday, September 10, 2017 3:51 AM
  • We need to set up something similar. How do you get all the http request to be routed to the same az function?

    thank you

    davide

    Monday, November 13, 2017 6:18 PM
  • Here is a proof of concept: http://www.luckenuik.net/hosting-your-aspnet-core-razor-pages-inside-azure-functions/

    Simon L.

    Wednesday, January 9, 2019 10:53 AM