azureazure-webjobsazure-worker-roles

Can an Azure dotnet worker with a webhost have a public URL


I have created a worker service with a host in dotnet core 3.1:

<Project Sdk="Microsoft.NET.Sdk.Worker;Microsoft.NET.Sdk.Web">

THe worker has its own web server because of the healthcheck endpoint.

This worker is deployed to Azure App Service and ends up as a webjob there. Now, when it starts up, it also starts the web server on http://localhost:5000 (looking at the logs). However, I have no clue how this could be mapped to the appservice's public URL: https://MYWORKER.scm.azurewebsites.net/

I did try http://MYWORKER.scm.azurewebsites.net:5000/ but nothing is there.

Does anyone know how the worker's host can be mapped to the app service's URL or a subpath of some sort?


Solution

  • You can't. Web Jobs are meant to run background tasks and are not exposed over HTTP by App Service. I'd suggest you look at Azure Functions and Azure Container Instances.