Hosting blazor server website and asp net core api in same shared windows hosting package

kevin mungame 1 Reputation point
2022-02-10T15:24:10.5+00:00

I have a solution with multiple projects; blazor server app, asp .net core web api and blazor server admin app which I would like to host in shared windows hosting package like godaddy. Can I publish the apps in httpdocs virtual folders?

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,595 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Lohith GN 511 Reputation points
    2022-04-04T03:09:51.62+00:00

    Hi, @kevin mungame .

    Theoretically yes. The service to use is Azure App Service. By default, your code is deployed to a folder called "site\wwwroot" and the root of your URL is mapped to this folder.

    You will need to create a deployment package like below:

    • BlazorServerApp
    • AspNetCoreWebApi
    • BlazorServerAdminApp

    Steps to make this work will be:

    • Create Azure App Service in Azure Portal - your subscription
    • Go to Azure App Service you created
    • Select Configuration from the left hand menu bar
    • In Configuration page, select Path Mappings
    • Edit the existing path mapping which is set to site\wwwroot. This is your root of the URL. So repoint it to site\wwwroot\BlazorServerApp
    • Add another Path Mapping. this time set the Virtual path to "/api" and physical path to "site\wwwroot\AspNetCoreWebApi". save,
    • Add another Path mapping. this time set the Virtaul path to "/admin" and physical path to "site\wwwroot\BlazorServerAdminApp". save

    Deploy your package using CI/CD flows.

    After deployment, if you navigate to https://yourappname.azurewebsites.net - this will be your BlazorServerApp. https://yourappname.azurewebsites.net/api will be your AspNetCoreWebApi and https://yourappname.azurewebsites.net/admin will be your BlazorServerAdminApp

    As I said - this is theoretically possible. But from an Architectural standpoint - we never do this way of deployment. Its not advisable. You should be created 3 azure app service - 1 for each app and deploy them independently. This way your app is scalable.

    Hope this helps.

    0 comments No comments

  2. Lohith GN 511 Reputation points
    2022-04-04T03:17:36.95+00:00

    You can check this documentation to create a virtual applications in your Azure App Service: https://learn.microsoft.com/en-us/azure/app-service/configure-common?tabs=portal#map-a-url-path-to-a-directory

    0 comments No comments

  3. Lohith GN 511 Reputation points
    2022-04-04T13:35:56.487+00:00

    @kevin mungame Also - because you are using Blazor Server as the web technology - its not advisable to run 3 web apps in 1 App Service. Blazor Server relies on SignalR for server to client circuit. If you have load - 1 app service cannot manage 2 signalr load. Hence its advisable to go for separate app services.

    If you don't want to go for separate app services for your blazor web apps - then I suggest use Azure SignalR service in your blazor server apps. That way you will get the scale required by the web app when there is huge load.

    Hope this helps.

    Note: Mark this as answer, if this answered your question. Thanks.

    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.