How to publish python code in app service which using dotnetcore runtime stack

Santhosh Nethaji 0 Reputation points
2023-07-31T17:52:01.8933333+00:00

We have API built on c# and running in dotnetcore runtime stack in the azure app service resource. Now, we have developed other APIs using python locally.

Now, we need to understand if we can deploy/publish python code in existing web app which is dotnetcore runtime stack.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Konstantinos Passadis 19,586 Reputation points MVP
    2023-07-31T18:07:19.46+00:00

    Hello @Santhosh Nethaji !

    Welcome to Microsoft QnA!

    Startig a journey on Azure suggests a good understanding of the ecosystem and particularly the services we are going to use

    Azure App Service is an HTTP-based service for hosting web applications, REST APIs, and mobile back ends. You can develop in your favorite language, be it .NET, .NET Core, Java, Node.js, PHP, and Python. Applications run and scale with ease on both Windows and Linux-based environments.

    However each App Service instance is dedicated to a single runtime stack, meaning you cannot directly mix and deploy both .NET Core and Python code in the same Azure App Service instance.

    So there are some solutions :

    use separate App Services

    Deploy your C# .NET Core API in your existing Azure App Service instance, and deploy the Python API in a new, separate Azure App Service. Since you can use Custom Domains you can provide an experience to the end users as of a unified Solution

    Azure Functions

    Azure Functions is a serverless solution that allows you to write less code, maintain less infrastructure, and save on costs. Instead of worrying about deploying and maintaining servers, the cloud infrastructure provides all the up-to-date resources needed to keep your applications running.

    You focus on the code that matters most to you, in the most productive language for you, and Azure Functions handles the rest.

    https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview?pivots=programming-language-csharp

    You can deploy your C# .NET Core API as a C# Azure Function and your Python API as a Python Azure Function. You can still use custom domains or subdomains

    API Management / API Gateway

    Azure API Management is made up of an API gateway, a management plane, and a developer portal. These components are Azure-hosted and fully managed by default. API Management is available in various tiers differing in capacity and features.

    An API gateway sits between clients and services. It acts as a reverse proxy, routing requests from clients to services. It may also perform various cross-cutting tasks such as authentication, SSL termination, and rate limiting. If you don't deploy a gateway, clients must send requests directly to front-end services. API Management allows you to expose multiple APIs under the same domain, and it can route incoming requests to the appropriate backend API based on the URL path or other criteria.

    I cannot leave behind Containers .

    You can use Docker to containerize your APIs and use Azure Container Instance or an Azure Kubernetes Service (AKS) cluster to have a single Management Plane

    https://learn.microsoft.com/en-us/azure/container-apps/compare-options


    I hope this helps!

    Kindly mark the answer as Accepted and Upvote in case it helped!

    Regards

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.