Hosting Two Website Under one Web App - Azure Services
The current webapp under linux does not support virtual applications.
Relevant information
Virtual directory is IIS concept basically. we can't create virtual directory for Linux https://unix.stackexchange.com/questions/212842/is-it-possible-to-create-a-virtual-directory-in-linux.
Hard link will help us to create a virtual directory in Linux https://www.cyberciti.biz/faq/creating-hard-links-with-ln-command/.
Common linux virtual directories are http://www.emblogic.com/blog/02/common-linux-virtual-directories/
Azure app services in windows, can support virtual application because of IIS
can handler mappings and virtual applications and directories.
Azure webapp in linux, I'm not sure whether kestrel supports virtual applications and directories, at least not currently in azure web app products.
If you have more questions about azure web app, you can raise a support ticket on portal. You can also put forward your ideas and suggestions in the feedback, and optimize the product together with Microsoft official.
How to host multiple applications in the same Azure Web App Service?
I have the same setup as you; an ASP.NET Core web API, and a Blazor Server Side app.
As you want to use the same domain for both services, you would have to use Azure API Management or some other proxy if you were to route requests to two different Azure App Services.
An easier option is to deploy both services to the same App Service, but as different virtual applications. You publish your Blazor app as normal, but for the Web API you would publish to a new virtual application /api
.
To enable this virtual application, navigate to Configuration and then Path mappings in your App Service. Here you already have the default virtual application /
pointing to site\wwwroot
. You then add another virtual application named /api
pointing to site\wwwroot\api
:
When adding the virtual application, remember to remove checkbox for Directory (making it a virtual application instead), and optionally enable Preload:
If you publish your app using Azure DevOps Pipeline, it has an option to specify virtual application if another than default should be used.
You can now navigate to your two different URLs and hit each service. Note that when developing your Web API, you should not add api
to your controllers routes, as this virtual application does that for you.
How to publish two .net websites on one Azure WebApp?
Normally, your Front end webapp don't need connection string. So you can set your backend web app as main site. And you can manage
So you can deploy your front end in virtual application. You can check my answer in link which NebulaBC's comment for you.
Related Post:
1. How to deploy a Flask+React application to Azure Web Service
2. React.js - How to deploy client and server independently or together?
Two web apps under the same Azure Web App
Since other communities have provided suggestions, I just summarized the existing approaches and my ideas for you to achieve your purpose:
Use multiple virtual directories under a single web app as Zahid Faroq commented
Use two separate web apps
Since you are using azure web app, for a simple way, you could leverage App Service Certificate, and choose the S1 Standard certificate SKU which could create SSL bindings for root and www subdomain. Example: A single certificate could be used to protect
example.com
andwww.example.com
. If you use other subdomain instead of www and you could confirm that you only need two SSL certificates, then you need to buy an additional SSL formember.example.com
. Also, you could check WoTrus TLS / SSL Certificates, GoDaddy SSL Certificates, How to get FREE SSL Certificate for Website (HTTPS).
Related Topics
Setting Up a Cronjob on Google Compute Engine
How to Figure Out What Is Using a Linux Kernel Module
Expression After Last Specific Character
Context Switch in Interrupt Handlers
How to Execute Script in The Current Shell on Linux
How to Analyse a Crash Dump File Using Gdb
Jpegtran Optimize Without Changing Filename
How to Gently Kill Firefox Process on Linux/Os X
Can't Run Executable Linked with Libc
How Do 2 or More Fork System Calls Work
How Does Cron Internally Schedule Jobs
Parameter for Shell Scripts That Is Started with Qsub
What's the Meaning of a ! Before a Command in the Shell
How to Recover or Change Oracle Sysdba Password
Where to Start Learning About Linux Dma/Device Drivers/Memory Allocation