For anyone facing the same issue deploying ASP.NET core to app service through azure pipelines, you may check to see if web.config will is in the build files else you can add the web.config file. I had the same issue and in my case, adding the web.config fixed it for me.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\YourAspNetCoreApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>