Azure: Hosting asp.ent MVC with Web Api can I host them as a soltuion.

Aamiz 21 Reputation points
2020-12-04T09:48:58.3+00:00

Hi,
I am trying out hosting on Azure App Services. I crated a solution, it has two project. One for MVC and one for WebApi. MVC project consume Web api for its data. So this is currently on my local.

Now when I am doing the deployment, should I host Web Api and MVC project separately and I can host them a single solution as they run on my visual studio? Seem to me I would have to host them separately because I would need to get the uri and prior to hosting I can update my MVC code to the uri from the azure by replacing http://localhost.

Another point that I have in my mind that in MVC project under properties, there is a checkbox for dependencies, if I mark webapi then I assume it will also be deployed with the MVC project (sorry I am having issues therefore I wasn't able to deploy and test and figure out what is going on).
Can anyone guide me please. What would be the process. I seen several guide and articles but they are talking about both and how they can be integrated in azure.

I am trying to do the deploying the code to Azure hosting environment from Visual Studio 2019. I have already created the App Service.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,118 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Fei Han - MSFT 306 Reputation points Microsoft Vendor
    2020-12-07T08:21:45.19+00:00

    Hi @Aamiz , if you'd like to host both MVC and WebAPI applications on single Azure App Service app, you can achieve it by deploying them in two sub applications/directories.

    Besides, you may need to update the URL in your code based on the virtual applications or directories that your created while you consume the API.


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    With Regards,
    Fei Han

    0 comments No comments