OK, I must confess, I said: It works on my machine.
When I uploaded my code to DEV environment.. ¡Surprise! It crashes.
After doing some test in both, my local and dev environments, checking App Insights, Google and find out nothing, I decided to attach Visual Studio debugger to the Web App (only after telling my team about it, and only because it was DEV environment).
Thus, make sure that the App Service on Azure has remote debugging enabled.
MyAppService -> Configuration -> General Settings -> Debugging
Suddenly, a wild Pop Up appears on Visual Studio with something I’ve never ever seen:
Unable to attach to application ‘dotnet.exe’ (PID: 9504) using ‘mywebapp’. The 64-bit version of the Visual Studio Remote Debugger (MSVSMON.EXE) cannot be used to debug 32-bit processes or 32-bit dumps. Please use the 32-bit version instead.
It turns out that .NET CORE 2.2 SDK available by default at the Azure App Services is for 32bits
Thus, it does not take any effect configuring the Web App in 64 bit on Azure Portal. The IIS Worker Process, even running on 64 bit, will spawn .NET Core on 32 bit (due to .NET Core is only available by default on 32 bit). So the Visual Studio Debugger we should attach is the one on 32 bit as well.
If we configure the WebApp to run on 32 bit, Visual Studio will try to attach the 32 debugger this time:
Azure Portal → MyWebApp -> Configuration → General Settings → Platform Settings — Platform: 32 Bit
Nevertheless, if you want to run your application in 64 bit, you can configure the hosting model as InProcess. More info here.